i965: Fix intel_miptree_map() signature to be more 64-bit safe
authorChad Versace <chad.versace@linux.intel.com>
Wed, 19 Nov 2014 05:11:24 +0000 (21:11 -0800)
committerChad Versace <chad.versace@intel.com>
Mon, 22 Dec 2014 21:47:07 +0000 (15:47 -0600)
commitaebcf26d8219cee79da89313124c2147595a660c
treeed9e9d9b4bdad23ce032738501282f3ee8bae463
parentd11bc9fe8daf097741713cde6bdd79e1f0e0e8fc
i965: Fix intel_miptree_map() signature to be more 64-bit safe

This patch should diminish the likelihood of pointer arithmetic overflow
bugs, like the one fixed by b69c7c5dac.

Change the type of parameter 'out_stride' from int to ptrdiff_t. The
logic is that if you call intel_miptree_map() and use the value of
'out_stride', then you must be doing pointer arithmetic on 'out_ptr'.
Using ptrdiff_t instead of int should make a little bit harder to hit
overflow bugs.

As a side-effect, some function-scope variables needed to be retyped to
avoid compilation errors.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
src/mesa/drivers/dri/i965/intel_copy_image.c
src/mesa/drivers/dri/i965/intel_fbo.c
src/mesa/drivers/dri/i965/intel_mipmap_tree.c
src/mesa/drivers/dri/i965/intel_mipmap_tree.h
src/mesa/drivers/dri/i965/intel_tex.c