From 9b854ce53cb0550311d2252523fe088c281074d8 Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Thu, 2 Jun 2016 11:42:25 -0400 Subject: [PATCH] freedreno/a3xx+a4xx: fix potential null ptr deref Coverity spotted the a3xx case (not sure why not the a4xx). CID 1362452 Signed-off-by: Rob Clark --- src/gallium/drivers/freedreno/a3xx/fd3_gmem.c | 3 ++- src/gallium/drivers/freedreno/a4xx/fd4_gmem.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_gmem.c b/src/gallium/drivers/freedreno/a3xx/fd3_gmem.c index 81a613fa870..7b96d5eaee2 100644 --- a/src/gallium/drivers/freedreno/a3xx/fd3_gmem.c +++ b/src/gallium/drivers/freedreno/a3xx/fd3_gmem.c @@ -79,7 +79,8 @@ emit_mrt(struct fd_ringbuffer *ring, unsigned nr_bufs, if (rsc->stencil) { rsc = rsc->stencil; pformat = rsc->base.b.format; - bases++; + if (bases) + bases++; } slice = fd_resource_slice(rsc, psurf->u.tex.level); format = fd3_pipe2color(pformat); diff --git a/src/gallium/drivers/freedreno/a4xx/fd4_gmem.c b/src/gallium/drivers/freedreno/a4xx/fd4_gmem.c index c6fbf1c1d39..e2115454d86 100644 --- a/src/gallium/drivers/freedreno/a4xx/fd4_gmem.c +++ b/src/gallium/drivers/freedreno/a4xx/fd4_gmem.c @@ -80,7 +80,8 @@ emit_mrt(struct fd_ringbuffer *ring, unsigned nr_bufs, if (rsc->stencil) { rsc = rsc->stencil; pformat = rsc->base.b.format; - bases++; + if (bases) + bases++; } slice = fd_resource_slice(rsc, psurf->u.tex.level); -- 2.30.2