summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'kernel')
-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,
handle->offset = offset;
- WARN_ON_ONCE(handle->offset > handle->head);
+ /*
+ * Check we didn't copy past our reservation window, taking the
+ * possible unsigned int wrap into account.
+ */
+ WARN_ON_ONCE(((int)(handle->head - handle->offset)) < 0);
}
#define perf_output_put(handle, x) \