From 97a58f11c2a820a2678ec744eafad7aa93860932 Mon Sep 17 00:00:00 2001 From: Paulo Zanoni Date: Tue, 28 Apr 2026 16:59:15 -0700 Subject: [PATCH] intel/isl: fix assert when surf->size_B is > UINT_MAX I have some local tests for Sparse Resources that I wrote when I was working on that for Anv. One of them tries to create a sparse buffer with size 4294967296 (which doesn't fit in an uint32_t). Without this patch, the right side of the assertion overflows and we get: sparse: ../../src/intel/isl/isl.c:3787: isl_surf_from_mem: Assertion `surf->size_B == surf->row_pitch_B * extent.h * extent.a' failed Fixes: fcdae4d4c09c ("intel: Add and use isl_surf_from_mem()") Reviewed-by: Dylan Baker Signed-off-by: Paulo Zanoni Part-of: (cherry picked from commit c4b6df29bf50aba7046ca42d569729f2cf8de1d7) --- .pick_status.json | 2 +- src/intel/isl/isl.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 7cfee6ce6a3..6b896cd0ad1 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -2284,7 +2284,7 @@ "description": "intel/isl: fix assert when surf->size_B is > UINT_MAX", "nominated": true, "nomination_type": 2, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "fcdae4d4c09cfe3f8f38011a6e2b533cbb5e04f7", "notes": null diff --git a/src/intel/isl/isl.c b/src/intel/isl/isl.c index 5986497b0f6..96742c86e3f 100644 --- a/src/intel/isl/isl.c +++ b/src/intel/isl/isl.c @@ -3784,7 +3784,7 @@ isl_surf_from_mem(const struct isl_device *isl_dev, assert(ok); if (extent.a > 1) assert(surf->array_pitch_el_rows == extent.h); - assert(surf->size_B == surf->row_pitch_B * extent.h * extent.a); + assert(surf->size_B == (uint64_t)surf->row_pitch_B * extent.h * extent.a); assert(surf->size_B <= max_tiles * tile_size_B); }