From: Kenneth Lee Date: Fri, 19 Aug 2022 05:42:55 +0000 (-0700) Subject: ceph: Use kcalloc for allocating multiple elements X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=b5a88852c2fc0c8ecc8f2e13d20a4aad3b48fcb5;p=ceph-client.git ceph: Use kcalloc for allocating multiple elements 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 Signed-off-by: Xiubo Li --- diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c index c615e7b6d5c7..441e3c2ff042 100644 --- a/fs/ceph/caps.c +++ b/fs/ceph/caps.c @@ -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;