summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2009-05-06 18:40:51 +0200
committerSteven Rostedt <rostedt@goodmis.org>2009-05-06 18:49:20 +0200
commit00c81a58c5b4e0de14ee33bfbc3d71c90f69f9ea (patch)
treed34d323e0a3b67ee5ce4c0ae8a0b3dbbc9bf2562 /kernel
parentring-buffer: remove unneeded conditional in rb_reserve_next (diff)
downloadlinux-00c81a58c5b4e0de14ee33bfbc3d71c90f69f9ea.tar.xz
linux-00c81a58c5b4e0de14ee33bfbc3d71c90f69f9ea.zip
ring-buffer: check for failed allocation in ring buffer benchmark
The result of the allocation of the ring buffer read page in the ring buffer bench mark does not check the return to see if a page was actually allocated. This patch fixes that. [ Impact: avoid NULL dereference ] Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/trace/ring_buffer_benchmark.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/kernel/trace/ring_buffer_benchmark.c b/kernel/trace/ring_buffer_benchmark.c
index 747244acb8fd..dcd75e9e49f4 100644
--- a/kernel/trace/ring_buffer_benchmark.c
+++ b/kernel/trace/ring_buffer_benchmark.c
@@ -84,6 +84,9 @@ static enum event_status read_page(int cpu)
int i;
bpage = ring_buffer_alloc_read_page(buffer);
+ if (!bpage)
+ return EVENT_DROPPED;
+
ret = ring_buffer_read_page(buffer, &bpage, PAGE_SIZE, cpu, 1);
if (ret >= 0) {
rpage = bpage;