From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6067EC352A1 for ; Wed, 30 Nov 2022 18:34:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230228AbiK3SeF (ORCPT ); Wed, 30 Nov 2022 13:34:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42664 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230308AbiK3Sdk (ORCPT ); Wed, 30 Nov 2022 13:33:40 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B25332AC4B for ; Wed, 30 Nov 2022 10:33:39 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id EB77161D6F for ; Wed, 30 Nov 2022 18:33:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 060B0C433D6; Wed, 30 Nov 2022 18:33:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1669833218; bh=xIMnQIS8Er6JS+vkVx92DutyVRa0EuYxw8XLi7K/Nyk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GsuVuK90/2MfH9ZrKdz/ogEiriqSKDj2Gen8pL+KTVn3idSulCBxn2r+OyZC9rzGu 2mFl+Ap5uL7UmJul6e1hiwwILIQhq6v59KJHpbBpJK9fl9JFgx3Usfp4dXHITa3HSs GZo8VIFURp5A3ZN/Kd+33iNRJb1rwp0iKh/IiNas= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Kenneth Lee , Xiubo Li , Ilya Dryomov , Sasha Levin Subject: [PATCH 5.15 029/206] ceph: Use kcalloc for allocating multiple elements Date: Wed, 30 Nov 2022 19:21:21 +0100 Message-Id: <20221130180533.736266090@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221130180532.974348590@linuxfoundation.org> References: <20221130180532.974348590@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Kenneth Lee [ 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 Reviewed-by: Xiubo Li Signed-off-by: Ilya Dryomov Stable-dep-of: 5bd76b8de5b7 ("ceph: fix NULL pointer dereference for req->r_session") Signed-off-by: Sasha Levin --- fs/ceph/caps.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c index 883bb91ee257..a6e2aaff17dd 100644 --- a/fs/ceph/caps.c +++ b/fs/ceph/caps.c @@ -2255,7 +2255,7 @@ static int unsafe_request_wait(struct inode *inode) 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; -- 2.35.1