Mesa (master): svga: fix referencing a NULL framebuffer cbuf

Brian Paul brianp at kemper.freedesktop.org
Wed Sep 2 19:26:19 UTC 2015


Module: Mesa
Branch: master
Commit: 4a9480b64aed6986095c391ebba6b91212fb9277
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=4a9480b64aed6986095c391ebba6b91212fb9277

Author: Charmaine Lee <charmainel at vmware.com>
Date:   Fri Aug 21 11:41:26 2015 -0700

svga: fix referencing a NULL framebuffer cbuf

Check for a valid framebuffer cbuf pointer before accessing its
associated surface.

Fix piglit test fbo-drawbuffers-none.

Reviewed-by: Brian Paul <brianp at vmware.com>

---

 src/gallium/drivers/svga/svga_pipe_sampler.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_pipe_sampler.c b/src/gallium/drivers/svga/svga_pipe_sampler.c
index ab84ed3..60e2d44 100644
--- a/src/gallium/drivers/svga/svga_pipe_sampler.c
+++ b/src/gallium/drivers/svga/svga_pipe_sampler.c
@@ -455,8 +455,8 @@ svga_set_sampler_views(struct pipe_context *pipe,
     * for the conflicted surface view.
     */
    for (i = 0; i < svga->curr.framebuffer.nr_cbufs; i++) {
-      struct svga_surface *s = svga_surface(svga->curr.framebuffer.cbufs[i]);
-      if (s) {
+      if (svga->curr.framebuffer.cbufs[i]) {
+         struct svga_surface *s = svga_surface(svga->curr.framebuffer.cbufs[i]);
          if (svga_check_sampler_view_resource_collision(svga, s->handle, shader)) {
             svga->dirty |= SVGA_NEW_FRAME_BUFFER;
             break;




More information about the mesa-commit mailing list