From 76fb3961b12da083c18a25cde6e9a29ae3fdd498 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Fri, 19 Feb 2021 09:58:33 -0500 Subject: [PATCH] panfrost: Fix NULL deref in pan_sfbd The last of the nr_cbufs audit changes. Signed-off-by: Alyssa Rosenzweig Reviewed-by: Boris Brezillon Part-of: --- src/gallium/drivers/panfrost/pan_sfbd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/drivers/panfrost/pan_sfbd.c b/src/gallium/drivers/panfrost/pan_sfbd.c index cf8b0ecae63..d13fb2fda4e 100644 --- a/src/gallium/drivers/panfrost/pan_sfbd.c +++ b/src/gallium/drivers/panfrost/pan_sfbd.c @@ -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;