summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2009-06-17 20:11:10 +0200
committerSteven Rostedt <rostedt@goodmis.org>2009-06-17 20:16:20 +0200
commit5f78abeebbf0a80975d719e11374535ca15396cb (patch)
tree8c5a5f11caadc1cb662152fb1ef84b5b1fa19bbb /kernel
parentring-buffer: remove useless compile check for buffer_page size (diff)
downloadlinux-5f78abeebbf0a80975d719e11374535ca15396cb.tar.xz
linux-5f78abeebbf0a80975d719e11374535ca15396cb.zip
ring-buffer: check for less than two in size allocation
The ring buffer must have at least two pages allocated for the reader page swap to work. The page count check will miss the case of a zero size passed in. Even though a zero size ring buffer would probably fail an allocation, making the min size check for less than two instead of equal to one makes the code a bit more robust. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/trace/ring_buffer.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index 162da2305cbc..2e99dba6dc48 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -657,8 +657,8 @@ struct ring_buffer *__ring_buffer_alloc(unsigned long size, unsigned flags,
buffer->reader_lock_key = key;
/* need at least two pages */
- if (buffer->pages == 1)
- buffer->pages++;
+ if (buffer->pages < 2)
+ buffer->pages = 2;
/*
* In case of non-hotplug cpu, if the ring-buffer is allocated