]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-client.git/commit
ceph: fix overflowed value issue in ceph_submit_write()
authorViacheslav Dubeyko <Slava.Dubeyko@ibm.com>
Wed, 4 Jun 2025 22:41:06 +0000 (15:41 -0700)
committerIlya Dryomov <idryomov@gmail.com>
Wed, 11 Jun 2025 07:45:05 +0000 (09:45 +0200)
commit9233d2c1fd2d072e9d85e14c2adb804df28c8c23
tree2a892512a5a402f10289b6e4758564d2db5c934a
parent805af8cfc0043c9ba24b4dce782dd124c5e96227
ceph: fix overflowed value issue in ceph_submit_write()

The Coverity Scan service has detected overflowed value
issue in ceph_submit_write() [1]. The CID 1646339 defect
contains explanation: "The overflowed value due to
arithmetic on constants is too small or unexpectedly
negative, causing incorrect computations.
In ceph_submit_write: Integer overflow occurs in
arithmetic on constant operands (CWE-190)".

This patch adds a check ceph_wbc->locked_pages on
equality to zero and it exits function if it has
zero value. Also, it introduces a processed_pages
variable with the goal of assigning the number of
processed pages and checking this number on
equality to zero. The check of processed_pages
variable on equality to zero should protect from
overflowed value of index that selects page in
ceph_wbc->pages[index] array.

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

Signed-off-by: Viacheslav Dubeyko <Slava.Dubeyko@ibm.com>
fs/ceph/addr.c