Mesa (9.2): i965: Fix brw_vs_prog_data_compare to actually check field members.

Carl Worth cworth at kemper.freedesktop.org
Fri Sep 27 23:03:18 UTC 2013


Module: Mesa
Branch: 9.2
Commit: e021b50227b4711ea7f0209e0c9fb48ecddd0092
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=e021b50227b4711ea7f0209e0c9fb48ecddd0092

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Mon Sep 16 22:39:37 2013 -0700

i965: Fix brw_vs_prog_data_compare to actually check field members.

&a and &b are the address of the local stack variables, not the actual
structures.  Instead of comparing the fields of a and b, we compared
...some stack memory.

Caught by Valgrind on Piglit's glsl-lod-bias test (among many others).

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=68233
Reviewed-by: Chad Versace <chad.versace at linux.intel.com>
Cc: mesa-stable at lists.freedesktop.org
(cherry picked from commit 4e4b0799165ae7b482da7d9af656ed8878500de1)

---

 src/mesa/drivers/dri/i965/brw_vs.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_vs.c b/src/mesa/drivers/dri/i965/brw_vs.c
index 5b8173d..f5cec21 100644
--- a/src/mesa/drivers/dri/i965/brw_vs.c
+++ b/src/mesa/drivers/dri/i965/brw_vs.c
@@ -204,7 +204,7 @@ brw_vs_prog_data_compare(const void *in_a, const void *in_b,
 
    /* Compare the rest of the struct. */
    const unsigned offset = sizeof(struct brw_vec4_prog_data);
-   if (memcmp(((char *) &a) + offset, ((char *) &b) + offset,
+   if (memcmp(((char *) a) + offset, ((char *) b) + offset,
               sizeof(struct brw_vs_prog_data) - offset)) {
       return false;
    }




More information about the mesa-commit mailing list