diff --git a/fs/read_write.c b/fs/read_write.c index 4da3e553090b..676728310899 100644 --- a/fs/read_write.c +++ b/fs/read_write.c @@ -1531,9 +1531,11 @@ static int generic_copy_file_checks(struct file *file_in, loff_t pos_in, else count = min(count, size_in - (uint64_t)pos_in); - ret = generic_write_check_limits(file_out, pos_out, &count); - if (ret) - return ret; + if (count) { + ret = generic_write_check_limits(file_out, pos_out, &count); + if (ret) + return ret; + } /* Don't allow overlapped copying within the same file. */ if (inode_in == inode_out &&