]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-client.git/commit
ceph: fix wrong sizeof argument issue in register_session()
authorViacheslav Dubeyko <Slava.Dubeyko@ibm.com>
Fri, 6 Jun 2025 19:05:21 +0000 (12:05 -0700)
committerIlya Dryomov <idryomov@gmail.com>
Wed, 11 Jun 2025 07:45:05 +0000 (09:45 +0200)
commit81a0dfff46bdfd4c2c23769d5eedb1eca458fc40
tree3b1b3dd4bb6d0242bf3f84a9901ff7377d340d51
parent03410ccaafd9baa21b64e23c7131749e5c6d9939
ceph: fix wrong sizeof argument issue in register_session()

The Coverity Scan service has detected the wrong sizeof
argument in register_session() [1]. The CID 1598909 defect
contains explanation: "The wrong sizeof value is used in
an expression or as argument to a function. The result is
an incorrect value that may cause unexpected program behaviors.
In register_session: The sizeof operator is invoked on
the wrong argument (CWE-569)".

The patch introduces a ptr_size variable that is initialized
by sizeof(struct ceph_mds_session *). And this variable is used
instead of sizeof(void *) in the code.

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

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