zink: assert that batch_id is valid in zink_screen_check_last_finished()

0 is never a valid batch_id

cc: mesa-stable

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27729>
(cherry picked from commit 35185ad9df8efa84981607cec3dd495c875a534b)
This commit is contained in:
Mike Blumenkrantz 2024-02-21 11:10:10 -05:00 committed by Eric Engestrom
parent ab000d7951
commit ffd79476ec
2 changed files with 2 additions and 1 deletions

View file

@ -304,7 +304,7 @@
"description": "zink: assert that batch_id is valid in zink_screen_check_last_finished()", "description": "zink: assert that batch_id is valid in zink_screen_check_last_finished()",
"nominated": true, "nominated": true,
"nomination_type": 0, "nomination_type": 0,
"resolution": 0, "resolution": 1,
"main_sha": null, "main_sha": null,
"because_sha": null, "because_sha": null,
"notes": null "notes": null

View file

@ -61,6 +61,7 @@ static inline bool
zink_screen_check_last_finished(struct zink_screen *screen, uint32_t batch_id) zink_screen_check_last_finished(struct zink_screen *screen, uint32_t batch_id)
{ {
const uint32_t check_id = (uint32_t)batch_id; const uint32_t check_id = (uint32_t)batch_id;
assert(check_id);
/* last_finished may have wrapped */ /* last_finished may have wrapped */
if (screen->last_finished < UINT_MAX / 2) { if (screen->last_finished < UINT_MAX / 2) {
/* last_finished has wrapped, batch_id has not */ /* last_finished has wrapped, batch_id has not */