summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965/brw_performance_monitor.c
diff options
context:
space:
mode:
authorChad Versace <chad.versace@linux.intel.com>2014-11-18 21:11:26 -0800
committerChad Versace <chad.versace@intel.com>2014-12-22 15:47:14 -0600
commit414be86c96836b35571185da776d2bce1b620c6a (patch)
tree0ec0d5c4d8f579bd1b1d15195d2a7e1683584eab /src/mesa/drivers/dri/i965/brw_performance_monitor.c
parent225a09790da0b1605a0b68acbbe1e0f30eee3e6f (diff)
downloadexternal_mesa3d-414be86c96836b35571185da776d2bce1b620c6a.zip
external_mesa3d-414be86c96836b35571185da776d2bce1b620c6a.tar.gz
external_mesa3d-414be86c96836b35571185da776d2bce1b620c6a.tar.bz2
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>
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_performance_monitor.c')
-rw-r--r--src/mesa/drivers/dri/i965/brw_performance_monitor.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_performance_monitor.c b/src/mesa/drivers/dri/i965/brw_performance_monitor.c
index edfa3d2..e683e40 100644
--- a/src/mesa/drivers/dri/i965/brw_performance_monitor.c
+++ b/src/mesa/drivers/dri/i965/brw_performance_monitor.c
@@ -907,7 +907,7 @@ gather_oa_results(struct brw_context *brw,
return;
}
- const int snapshot_size = brw->perfmon.entries_per_oa_snapshot;
+ const ptrdiff_t snapshot_size = brw->perfmon.entries_per_oa_snapshot;
/* First, add the contributions from the "head" interval:
* (snapshot taken at BeginPerfMonitor time,