Skip to content

Commit

Permalink
ring-buffer: check for failed allocation in ring buffer benchmark
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Steven Rostedt authored and Steven Rostedt committed May 6, 2009
1 parent 8e7abf1 commit 00c81a5
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions kernel/trace/ring_buffer_benchmark.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 00c81a5

Please sign in to comment.