diff options
author | Chad Versace <[email protected]> | 2014-12-22 15:58:49 -0600 |
---|---|---|
committer | Emil Velikov <[email protected]> | 2015-01-04 21:39:10 +0000 |
commit | fffe533f08d7c0cc61841195216e54587a1b77ad (patch) | |
tree | 32b634e563f11ddc2d5cc6d3f79adba331556762 /src/mesa/drivers/dri | |
parent | 4d5e0f78b7c1a8239800a3f2a5f8c82178b5f868 (diff) |
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 <[email protected]>
Signed-off-by: Chad Versace <[email protected]>
(cherry picked from commit 414be86c96836b35571185da776d2bce1b620c6a)
Diffstat (limited to 'src/mesa/drivers/dri')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_performance_monitor.c | 2 |
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 edfa3d2ec2a..e683e40e55f 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, |