]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-client.git/commitdiff
ceph: Use kcalloc for allocating multiple elements
authorKenneth Lee <klee33@uw.edu>
Fri, 19 Aug 2022 05:42:55 +0000 (22:42 -0700)
committerXiubo Li <xiubli@redhat.com>
Fri, 26 Aug 2022 23:51:58 +0000 (07:51 +0800)
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>
Signed-off-by: Xiubo Li <xiubli@redhat.com>
fs/ceph/caps.c

index c615e7b6d5c700ef151c880a4d44da65bbf94ea3..441e3c2ff04243e437040236531fb8d9cb6b9f96 100644 (file)
@@ -2337,7 +2337,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;