summaryrefslogtreecommitdiffstats
path: root/fs/ceph/file.c
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@linaro.org>2023-10-07 11:52:39 +0300
committerIlya Dryomov <idryomov@gmail.com>2023-10-09 13:35:24 +0200
commit07bb00ef00ace88dd6f695fadbba76565756e55c (patch)
tree4b3c29538b04242b6750f2fdc5ac217c401abe8a /fs/ceph/file.c
parent7563cf17dce0a875ba3d872acdc63a78ea344019 (diff)
downloadlinux-07bb00ef00ace88dd6f695fadbba76565756e55c.tar.gz
linux-07bb00ef00ace88dd6f695fadbba76565756e55c.tar.bz2
linux-07bb00ef00ace88dd6f695fadbba76565756e55c.zip
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: 1b0c3b9f91f0 ("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>
Diffstat (limited to 'fs/ceph/file.c')
-rw-r--r--fs/ceph/file.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/ceph/file.c b/fs/ceph/file.c
index b1da02f5dbe3..b5f8038065d7 100644
--- a/fs/ceph/file.c
+++ b/fs/ceph/file.c
@@ -2969,7 +2969,7 @@ static ssize_t __ceph_copy_file_range(struct file *src_file, loff_t src_off,
ret = do_splice_direct(src_file, &src_off, dst_file,
&dst_off, src_objlen, flags);
/* Abort on short copies or on error */
- if (ret < src_objlen) {
+ if (ret < (long)src_objlen) {
dout("Failed partial copy (%zd)\n", ret);
goto out;
}