提交 63e35b25 编写于 作者: P Peter Zijlstra 提交者: Ingo Molnar

perf_counter: sanity check on the output API

Ensure we never write more than we said we would.
Signed-off-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Arjan van de Ven <arjan@infradead.org>
Cc: Wu Fengguang <fengguang.wu@intel.com>
Orig-LKML-Reference: <20090325113316.921433024@chello.nl>
Signed-off-by: NIngo Molnar <mingo@elte.hu>
上级 5c148194
......@@ -1422,6 +1422,7 @@ struct perf_output_handle {
struct perf_counter *counter;
struct perf_mmap_data *data;
unsigned int offset;
unsigned int head;
int wakeup;
};
......@@ -1447,6 +1448,7 @@ static int perf_output_begin(struct perf_output_handle *handle,
handle->counter = counter;
handle->data = data;
handle->offset = offset;
handle->head = head;
handle->wakeup = (offset >> PAGE_SHIFT) != (head >> PAGE_SHIFT);
return 0;
......@@ -1485,6 +1487,8 @@ static void perf_output_copy(struct perf_output_handle *handle,
} while (len);
handle->offset = offset;
WARN_ON_ONCE(handle->offset > handle->head);
}
#define perf_output_put(handle, x) \
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册