]> 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 Feb 2026 18:19:16 +0000 (19:19 +0100)
commit50fd6243bd63dbf9372082c43295d9072e61a2ce
tree1814f292d1d727ab524e807489898c22380cad78
parentfc19f7ccb9623ee5d5a9e3da1917f7b25693f189
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