summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/freedreno
diff options
context:
space:
mode:
authorRob Clark <[email protected]>2016-06-02 11:42:25 -0400
committerRob Clark <[email protected]>2016-06-02 15:44:07 -0400
commit9b854ce53cb0550311d2252523fe088c281074d8 (patch)
tree0ad80b39a37c6971adee4343565a8fa3ea28eca5 /src/gallium/drivers/freedreno
parent27a97097e1a6d8f0a29393b2fcc6fdb0a500bf92 (diff)
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 <[email protected]>
Diffstat (limited to 'src/gallium/drivers/freedreno')
-rw-r--r--src/gallium/drivers/freedreno/a3xx/fd3_gmem.c3
-rw-r--r--src/gallium/drivers/freedreno/a4xx/fd4_gmem.c3
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);