Skip to content

Commit

Permalink
vfs: exit early from zero length remap operations
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Darrick J. Wong authored and Dave Chinner committed Oct 29, 2018
1 parent 1383a7e commit 2c5773f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fs/read_write.c
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down

0 comments on commit 2c5773f

Please sign in to comment.