]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
fix default_file_splice_read()
authorAl Viro <viro@zeniv.linux.org.uk>
Sun, 27 Nov 2016 01:05:42 +0000 (20:05 -0500)
committerAl Viro <viro@zeniv.linux.org.uk>
Sun, 27 Nov 2016 01:05:42 +0000 (20:05 -0500)
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 <ast@kernel.org>
Tested-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/splice.c

index dcaf185a5731130ab67bd7076a9be26dd4f0d7f0..5a7750bd2eea765d06f5e8b76687701b24867c7b 100644 (file)
@@ -408,7 +408,8 @@ static ssize_t default_file_splice_read(struct file *in, loff_t *ppos,
        if (res <= 0)
                return -ENOMEM;
 
-       nr_pages = res / PAGE_SIZE;
+       BUG_ON(dummy);
+       nr_pages = DIV_ROUND_UP(res, PAGE_SIZE);
 
        vec = __vec;
        if (nr_pages > PIPE_DEF_BUFFERS) {