From 716e483cfb4cae812afd9865cb4b94025c0632a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Tue, 6 Feb 2024 00:06:57 -0500 Subject: [PATCH] util/idalloc: make deleting invalid IDs a no-op This happens with piglit tests if we enable ForceGLNamesReuse for everything. Reviewed-by: Adam Jackson Part-of: --- src/util/u_idalloc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/util/u_idalloc.c b/src/util/u_idalloc.c index 1a0e83b6df5..4abe478a9c8 100644 --- a/src/util/u_idalloc.c +++ b/src/util/u_idalloc.c @@ -144,8 +144,11 @@ ret: void util_idalloc_free(struct util_idalloc *buf, unsigned id) { - assert(id / 32 < buf->num_elements); unsigned idx = id / 32; + + if (idx >= buf->num_elements) + return; + buf->lowest_free_idx = MIN2(idx, buf->lowest_free_idx); buf->data[idx] &= ~(1 << (id % 32)); }