diff options
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/trace/trace.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 94629760dabf..1ce5dc6372b8 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
@@ -3428,7 +3428,19 @@ tracing_buffers_splice_read(struct file *file, loff_t *ppos, | |||
3428 | int size, i; | 3428 | int size, i; |
3429 | size_t ret; | 3429 | size_t ret; |
3430 | 3430 | ||
3431 | for (i = 0; i < PIPE_BUFFERS && len; i++, len -= size) { | 3431 | if (*ppos & (PAGE_SIZE - 1)) { |
3432 | WARN_ONCE(1, "Ftrace: previous read must page-align\n"); | ||
3433 | return -EINVAL; | ||
3434 | } | ||
3435 | |||
3436 | if (len & (PAGE_SIZE - 1)) { | ||
3437 | WARN_ONCE(1, "Ftrace: splice_read should page-align\n"); | ||
3438 | if (len < PAGE_SIZE) | ||
3439 | return -EINVAL; | ||
3440 | len &= PAGE_MASK; | ||
3441 | } | ||
3442 | |||
3443 | for (i = 0; i < PIPE_BUFFERS && len; i++, len -= PAGE_SIZE) { | ||
3432 | struct page *page; | 3444 | struct page *page; |
3433 | int r; | 3445 | int r; |
3434 | 3446 | ||
@@ -3467,7 +3479,7 @@ tracing_buffers_splice_read(struct file *file, loff_t *ppos, | |||
3467 | spd.partial[i].offset = 0; | 3479 | spd.partial[i].offset = 0; |
3468 | spd.partial[i].private = (unsigned long)ref; | 3480 | spd.partial[i].private = (unsigned long)ref; |
3469 | spd.nr_pages++; | 3481 | spd.nr_pages++; |
3470 | *ppos += size; | 3482 | *ppos += PAGE_SIZE; |
3471 | } | 3483 | } |
3472 | 3484 | ||
3473 | spd.nr_pages = i; | 3485 | spd.nr_pages = i; |