From: Rob Clark Date: Thu, 2 Jun 2016 15:42:25 +0000 (-0400) Subject: freedreno/a3xx+a4xx: fix potential null ptr deref X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9b854ce53cb0550311d2252523fe088c281074d8;p=mesa.git 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 --- 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);