Re: [Mesa-dev] [PATCH] i915: Fix wrong sizeof argument in i915_update_tex_unit.

2012-11-21 Thread Ian Romanick

On 11/20/2012 09:51 PM, Vinson Lee wrote:

The bug was found by Coverity.

Signed-off-by: Vinson Lee v...@freedesktop.org


Heh... since sizeof(state) and sizeof(*state) are the same on 32-bit 
platforms, this only could have cause problems for a small subset of 
users.  This is probably part of the reason it was never noticed. :) 
It's pretty shocking that this line of code has existed since the driver 
first landed in 2006!


Could you also mark this for inclusion in all stable branches?

Reviewed-by: Ian Romanick ian.d.roman...@intel.com


---
  src/mesa/drivers/dri/i915/i915_texstate.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i915/i915_texstate.c 
b/src/mesa/drivers/dri/i915/i915_texstate.c
index 4bd5e72..94a8e55 100644
--- a/src/mesa/drivers/dri/i915/i915_texstate.c
+++ b/src/mesa/drivers/dri/i915/i915_texstate.c
@@ -146,7 +146,7 @@ i915_update_tex_unit(struct intel_context *intel, GLuint 
unit, GLuint ss3)
 GLubyte border[4];
 GLfloat maxlod;

-   memset(state, 0, sizeof(state));
+   memset(state, 0, sizeof(*state));

 /*We need to refcount these. */




___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] i915: Fix wrong sizeof argument in i915_update_tex_unit.

2012-11-21 Thread Matt Turner
On Wed, Nov 21, 2012 at 12:02 AM, Ian Romanick i...@freedesktop.org wrote:
 On 11/20/2012 09:51 PM, Vinson Lee wrote:

 The bug was found by Coverity.

 Signed-off-by: Vinson Lee v...@freedesktop.org


 Heh... since sizeof(state) and sizeof(*state) are the same on 32-bit
 platforms, this only could have cause problems for a small subset of users.
 This is probably part of the reason it was never noticed. :) It's pretty
 shocking that this line of code has existed since the driver first landed in
 2006!

And the bad part is that Chad noticed and fixed this in
/i830/_update_tex_unit (735070c45b403a9631415b09e9fd519f601f0229) back
in July but not this one. :)
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] i915: Fix wrong sizeof argument in i915_update_tex_unit.

2012-11-20 Thread Vinson Lee
The bug was found by Coverity.

Signed-off-by: Vinson Lee v...@freedesktop.org
---
 src/mesa/drivers/dri/i915/i915_texstate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i915/i915_texstate.c 
b/src/mesa/drivers/dri/i915/i915_texstate.c
index 4bd5e72..94a8e55 100644
--- a/src/mesa/drivers/dri/i915/i915_texstate.c
+++ b/src/mesa/drivers/dri/i915/i915_texstate.c
@@ -146,7 +146,7 @@ i915_update_tex_unit(struct intel_context *intel, GLuint 
unit, GLuint ss3)
GLubyte border[4];
GLfloat maxlod;
 
-   memset(state, 0, sizeof(state));
+   memset(state, 0, sizeof(*state));
 
/*We need to refcount these. */
 
-- 
1.8.0

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] i915: Fix wrong sizeof argument in i915_update_tex_unit.

2012-11-13 Thread Vinson Lee
The bug was found by Coverity.

Signed-off-by: Vinson Lee v...@freedesktop.org
---
 src/mesa/drivers/dri/i915/i915_texstate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i915/i915_texstate.c 
b/src/mesa/drivers/dri/i915/i915_texstate.c
index 4bd5e72..94a8e55 100644
--- a/src/mesa/drivers/dri/i915/i915_texstate.c
+++ b/src/mesa/drivers/dri/i915/i915_texstate.c
@@ -146,7 +146,7 @@ i915_update_tex_unit(struct intel_context *intel, GLuint 
unit, GLuint ss3)
GLubyte border[4];
GLfloat maxlod;
 
-   memset(state, 0, sizeof(state));
+   memset(state, 0, sizeof(*state));
 
/*We need to refcount these. */
 
-- 
1.8.0

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev