mirror of
https://github.com/torvalds/linux.git
synced 2026-06-06 13:37:36 +02:00
ceph: Use kcalloc for allocating multiple elements
[ Upstream commitaa1d627207] 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:5bd76b8de5("ceph: fix NULL pointer dereference for req->r_session") Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
69263bf781
commit
00c004c070
|
|
@ -2335,7 +2335,7 @@ static int unsafe_request_wait(struct inode *inode)
|
||||||
struct ceph_mds_request *req;
|
struct ceph_mds_request *req;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
sessions = kzalloc(max_sessions * sizeof(s), GFP_KERNEL);
|
sessions = kcalloc(max_sessions, sizeof(s), GFP_KERNEL);
|
||||||
if (!sessions) {
|
if (!sessions) {
|
||||||
err = -ENOMEM;
|
err = -ENOMEM;
|
||||||
goto out;
|
goto out;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user