mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-16 16:54:20 +08:00
Merge branch 'perf-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'perf-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: ring_buffer: Off-by-one and duplicate events in ring_buffer_read_page
This commit is contained in:
commit
6f7f41851c
@ -3853,6 +3853,13 @@ int ring_buffer_read_page(struct ring_buffer *buffer,
|
||||
|
||||
/* Need to copy one event at a time */
|
||||
do {
|
||||
/* We need the size of one event, because
|
||||
* rb_advance_reader only advances by one event,
|
||||
* whereas rb_event_ts_length may include the size of
|
||||
* one or two events.
|
||||
* We have already ensured there's enough space if this
|
||||
* is a time extend. */
|
||||
size = rb_event_length(event);
|
||||
memcpy(bpage->data + pos, rpage->data + rpos, size);
|
||||
|
||||
len -= size;
|
||||
@ -3867,7 +3874,7 @@ int ring_buffer_read_page(struct ring_buffer *buffer,
|
||||
event = rb_reader_event(cpu_buffer);
|
||||
/* Always keep the time extend and data together */
|
||||
size = rb_event_ts_length(event);
|
||||
} while (len > size);
|
||||
} while (len >= size);
|
||||
|
||||
/* update bpage */
|
||||
local_set(&bpage->commit, pos);
|
||||
|
Loading…
Reference in New Issue
Block a user