Skip to content

Commit 8e54cad

Browse files
author
Al Viro
committed
fix default_file_splice_read()
Botched calculation of number of pages. As the result, we were dropping pieces when doing splice to pipe from e.g. 9p. Reported-by: Alexei Starovoitov <[email protected]> Tested-by: Alexei Starovoitov <[email protected]> Signed-off-by: Al Viro <[email protected]>
1 parent 3ad0e83 commit 8e54cad

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

fs/splice.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,8 @@ static ssize_t default_file_splice_read(struct file *in, loff_t *ppos,
408408
if (res <= 0)
409409
return -ENOMEM;
410410

411-
nr_pages = res / PAGE_SIZE;
411+
BUG_ON(dummy);
412+
nr_pages = DIV_ROUND_UP(res, PAGE_SIZE);
412413

413414
vec = __vec;
414415
if (nr_pages > PIPE_DEF_BUFFERS) {

0 commit comments

Comments
 (0)