iris: assert(bo->deps) after realloc()
authorPaulo Zanoni <paulo.r.zanoni@intel.com>
Fri, 8 Sep 2023 21:50:17 +0000 (14:50 -0700)
committerMarge Bot <emma+marge@anholt.net>
Tue, 19 Sep 2023 18:33:48 +0000 (18:33 +0000)
Iris in general doesn't really like checking the return value of its
allocations, but in some places it does assert that those pointers are
non-NULL. We've recently investigated a bug that could have been
coming from a failed bo->deps realloc(), so add the assert() here to
help give us more confidence over things the next time we're debugging
issues.

Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25236>

src/gallium/drivers/iris/iris_batch.c

index c3378a2..4cb138c 100644 (file)
@@ -750,6 +750,7 @@ update_bo_syncobjs(struct iris_batch *batch, struct iris_bo *bo, bool write)
    if (screen->id >= bo->deps_size) {
       int new_size = screen->id + 1;
       bo->deps = realloc(bo->deps, new_size * sizeof(bo->deps[0]));
+      assert(bo->deps);
       memset(&bo->deps[bo->deps_size], 0,
              sizeof(bo->deps[0]) * (new_size - bo->deps_size));