OSDN Git Service

i965: Use safer pointer arithmetic in gather_oa_results()
authorChad Versace <chad.versace@linux.intel.com>
Wed, 19 Nov 2014 05:11:26 +0000 (21:11 -0800)
committerChad Versace <chad.versace@intel.com>
Mon, 22 Dec 2014 21:47:14 +0000 (15:47 -0600)
commit414be86c96836b35571185da776d2bce1b620c6a
tree0ec0d5c4d8f579bd1b1d15195d2a7e1683584eab
parent225a09790da0b1605a0b68acbbe1e0f30eee3e6f
i965: Use safer pointer arithmetic in gather_oa_results()

This patch reduces the likelihood of pointer arithmetic overflow bugs in
gather_oa_results(), like the one fixed by b69c7c5dac.

I haven't yet encountered any overflow bugs in the wild along this
patch's codepath. But I get nervous when I see code patterns like this:

   (void*) + (int) * (int)

I smell 32-bit overflow all over this code.

This patch retypes 'snapshot_size' to 'ptrdiff_t', which should fix any
potential overflow.

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