panfrost: Assert on sysval overflow
authorIcecream95 <ixn@disroot.org>
Mon, 28 Dec 2020 11:49:36 +0000 (00:49 +1300)
committerMarge Bot <eric+marge@anholt.net>
Mon, 18 Jan 2021 20:49:45 +0000 (20:49 +0000)
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8358>

src/panfrost/util/pan_sysval.c

index f28d3a1..80e4469 100644 (file)
@@ -123,6 +123,7 @@ panfrost_nir_assign_sysval_body(struct panfrost_sysvals *ctx, nir_instr *instr)
         /* It hasn't -- so assign it now! */
 
         unsigned id = ctx->sysval_count++;
+        assert(id < MAX_SYSVAL_COUNT);
         _mesa_hash_table_u64_insert(ctx->sysval_to_id, sysval, (void *) ((uintptr_t) id + 1));
         ctx->sysvals[id] = sysval;
 }