Skip to content

Commit 123856f

Browse files
dhowellsaxboe
authored andcommitted
splice: Check for zero count in vfs_splice_read()
Make vfs_splice_read() return immediately if the length is 0. Signed-off-by: David Howells <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Reviewed-by: Christian Brauner <[email protected]> cc: Jens Axboe <[email protected]> cc: Al Viro <[email protected]> cc: [email protected] cc: [email protected] cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 6a3f30b commit 123856f

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

fs/splice.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -891,6 +891,8 @@ long vfs_splice_read(struct file *in, loff_t *ppos,
891891

892892
if (unlikely(!(in->f_mode & FMODE_READ)))
893893
return -EBADF;
894+
if (!len)
895+
return 0;
894896

895897
/* Don't try to read more the pipe has space for. */
896898
p_space = pipe->max_usage - pipe_occupancy(pipe->head, pipe->tail);

0 commit comments

Comments
 (0)