]> git.apps.os.sepia.ceph.com Git - ceph-client.git/commit
ceph: fix overflowed constant issue in ceph_do_objects_copy()
authorViacheslav Dubeyko <Slava.Dubeyko@ibm.com>
Fri, 6 Jun 2025 19:05:45 +0000 (12:05 -0700)
committerIlya Dryomov <idryomov@gmail.com>
Wed, 8 Oct 2025 21:30:46 +0000 (23:30 +0200)
commit5b2d1377d6cc4147492780b0bd95fb9c4cb28d1b
treec43f569812c77043a73a6c3a41f656edc990e682
parent1ed4471a4ee6cfa902467332042158ca5ef8ad24
ceph: fix overflowed constant issue in ceph_do_objects_copy()

The Coverity Scan service has detected overflowed constant
issue in ceph_do_objects_copy() [1]. The CID 1624308
defect contains explanation: "The overflowed value due to
arithmetic on constants is too small or unexpectedly
negative, causing incorrect computations. Expression bytes,
which is equal to -95, where ret is known to be equal to -95,
underflows the type that receives it, an unsigned integer
64 bits wide. In ceph_do_objects_copy: Integer overflow occurs
in arithmetic on constant operands (CWE-190)".

The patch changes the type of bytes variable from size_t
to ssize_t with the goal of to be capable to receive
negative values.

[1] https://scan5.scan.coverity.com/#/project-view/64304/10063?selectedIssue=1624308

Signed-off-by: Viacheslav Dubeyko <Slava.Dubeyko@ibm.com>
Reviewed-by: Alex Markuze <amarkuze@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
fs/ceph/file.c