Skip to content

Commit 07bb00e

Browse files
Dan Carpenteridryomov
authored andcommitted
ceph: fix type promotion bug on 32bit systems
In this code "ret" is type long and "src_objlen" is unsigned int. The problem is that on 32bit systems, when we do the comparison signed longs are type promoted to unsigned int. So negative error codes from do_splice_direct() are treated as success instead of failure. Cc: stable@vger.kernel.org Fixes: 1b0c3b9 ("ceph: re-org copy_file_range and fix some error paths") Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Reviewed-by: Xiubo Li <xiubli@redhat.com> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
1 parent 7563cf1 commit 07bb00e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/ceph/file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2969,7 +2969,7 @@ static ssize_t __ceph_copy_file_range(struct file *src_file, loff_t src_off,
29692969
ret = do_splice_direct(src_file, &src_off, dst_file,
29702970
&dst_off, src_objlen, flags);
29712971
/* Abort on short copies or on error */
2972-
if (ret < src_objlen) {
2972+
if (ret < (long)src_objlen) {
29732973
dout("Failed partial copy (%zd)\n", ret);
29742974
goto out;
29752975
}

0 commit comments

Comments
 (0)