panfrost: Fix NULL deref in pan_sfbd
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Fri, 19 Feb 2021 14:58:33 +0000 (09:58 -0500)
committerMarge Bot <eric+marge@anholt.net>
Mon, 22 Feb 2021 19:17:49 +0000 (19:17 +0000)
The last of the nr_cbufs audit changes.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9164>

src/gallium/drivers/panfrost/pan_sfbd.c

index cf8b0ec..d13fb2f 100644 (file)
@@ -221,7 +221,7 @@ panfrost_sfbd_fragment(struct panfrost_batch *batch, bool has_draws)
 
                 /* SFBD does not support MRT natively; sanity check */
                 assert(batch->key.nr_cbufs <= 1);
-                if (batch->key.nr_cbufs) {
+                if (batch->key.nr_cbufs && batch->key.cbufs[0]) {
                         struct pipe_surface *surf = batch->key.cbufs[0];
                         struct panfrost_resource *rsrc = pan_resource(surf->texture);
                         struct panfrost_bo *bo = rsrc->bo;