提交 5f78abee 编写于 作者: S Steven Rostedt 提交者: Steven Rostedt

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: NSteven Rostedt <rostedt@goodmis.org>
上级 0dcd4d6c
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册