summaryrefslogtreecommitdiffstats
path: root/fs/read_write.c
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2018-10-30 10:40:39 +1100
committerDave Chinner <david@fromorbit.com>2018-10-30 10:40:39 +1100
commit2c5773f102c9bb07d5328467f61f0a88f2f2892d (patch)
treed756b4acc043cd59ca1e89b394fb16c375683833 /fs/read_write.c
parent1383a7ed67490fb00d793e36c7a4d599ff88a64d (diff)
downloadlinux-2c5773f102c9bb07d5328467f61f0a88f2f2892d.tar.bz2
vfs: exit early from zero length remap operations
If a remap caller asks us to remap to the source file's EOF and the source file length leaves us with a zero byte request, exit early. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dave Chinner <david@fromorbit.com>
Diffstat (limited to 'fs/read_write.c')
-rw-r--r--fs/read_write.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/read_write.c b/fs/read_write.c
index d6e8e242a15f..2456da3f8a41 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -1748,6 +1748,8 @@ int vfs_clone_file_prep(struct file *file_in, loff_t pos_in,
if (pos_in > isize)
return -EINVAL;
*len = isize - pos_in;
+ if (*len == 0)
+ return 0;
}
/* Check that we don't violate system file offset limits. */