summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorKenneth Lee <klee33@uw.edu>2022-08-18 22:42:55 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-12-02 17:40:03 +0100
commit00c004c070f22a47063de4ff2a5638fce1f94d95 (patch)
tree77a8d9a289ec23c6365877e252547aec146545fb /fs
parent69263bf781bef3841f22815b834a5243474aa6d4 (diff)
downloadlinux-stable-00c004c070f22a47063de4ff2a5638fce1f94d95.tar.gz
linux-stable-00c004c070f22a47063de4ff2a5638fce1f94d95.tar.bz2
linux-stable-00c004c070f22a47063de4ff2a5638fce1f94d95.zip
ceph: Use kcalloc for allocating multiple elements
[ Upstream commit aa1d627207cace003163dee24d1c06fa4e910c6b ] Prefer using kcalloc(a, b) over kzalloc(a * b) as this improves semantics since kcalloc is intended for allocating an array of memory. Signed-off-by: Kenneth Lee <klee33@uw.edu> Reviewed-by: Xiubo Li <xiubli@redhat.com> Signed-off-by: Ilya Dryomov <idryomov@gmail.com> Stable-dep-of: 5bd76b8de5b7 ("ceph: fix NULL pointer dereference for req->r_session") Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/ceph/caps.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
index ce6a858e765a..668be87ffee6 100644
--- a/fs/ceph/caps.c
+++ b/fs/ceph/caps.c
@@ -2335,7 +2335,7 @@ retry:
struct ceph_mds_request *req;
int i;
- sessions = kzalloc(max_sessions * sizeof(s), GFP_KERNEL);
+ sessions = kcalloc(max_sessions, sizeof(s), GFP_KERNEL);
if (!sessions) {
err = -ENOMEM;
goto out;