aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/perf_counter.c
diff options
context:
space:
mode:
authorPeter Zijlstra <a.p.zijlstra@chello.nl>2009-05-13 15:26:19 -0400
committerIngo Molnar <mingo@elte.hu>2009-05-15 03:46:59 -0400
commit53020fe81eecd0b7be295868ce5850ef8f41074e (patch)
tree9dd7a48273419161c3bb74a0c9d492c626124835 /kernel/perf_counter.c
parenta026dfecc035f213c1cfa0bf6407ce3155f6a9df (diff)
perf_counter: Fix perf_output_copy() WARN to account for overflow
The simple reservation test in perf_output_copy() failed to take unsigned int overflow into account, fix this. [ Impact: fix false positive warning with more than 4GB of profiling data ] Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Paul Mackerras <paulus@samba.org> Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com> LKML-Reference: <new-submission> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/perf_counter.c')
-rw-r--r--kernel/perf_counter.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index ff166c11b69a..985be0b662af 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -1927,7 +1927,11 @@ static void perf_output_copy(struct perf_output_handle *handle,
1927 1927
1928 handle->offset = offset; 1928 handle->offset = offset;
1929 1929
1930 WARN_ON_ONCE(handle->offset > handle->head); 1930 /*
1931 * Check we didn't copy past our reservation window, taking the
1932 * possible unsigned int wrap into account.
1933 */
1934 WARN_ON_ONCE(((int)(handle->head - handle->offset)) < 0);
1931} 1935}
1932 1936
1933#define perf_output_put(handle, x) \ 1937#define perf_output_put(handle, x) \