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 89B3EC433EF for ; Mon, 14 Mar 2022 11:50:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239661AbiCNLwC (ORCPT ); Mon, 14 Mar 2022 07:52:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237669AbiCNLwA (ORCPT ); Mon, 14 Mar 2022 07:52:00 -0400 Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F1D73F312; Mon, 14 Mar 2022 04:50:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inria.fr; s=dc; h=date:from:to:cc:subject:in-reply-to:message-id: references:mime-version; bh=5tca+TAwShJLomr3kMuD+RKN41E2Sud56aTrN49/wAs=; b=sZ6GqgN6LulclYMfrUGCFxnkK/8pww9se3SwTz6FOtPpcNrwPpBd+KQJ uocAZuk55q0BSZBflnbCyHtvtpyHyjGc/Nvhh2b+uYReATG6xYpslxJ9l iNJk5inyO3KJOwI78DJP0qJHrQ8Fba3Fgk9//L56GkGPt+pLtHSlzG22S w=; Authentication-Results: mail2-relais-roc.national.inria.fr; dkim=none (message not signed) header.i=none; spf=SoftFail smtp.mailfrom=julia.lawall@inria.fr; dmarc=fail (p=none dis=none) d=inria.fr X-IronPort-AV: E=Sophos;i="5.90,180,1643670000"; d="scan'208";a="25996944" Received: from dt-lawall.paris.inria.fr ([128.93.67.65]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Mar 2022 12:50:48 +0100 Date: Mon, 14 Mar 2022 12:50:48 +0100 (CET) From: Julia Lawall X-X-Sender: julia@hadrien To: Dan Carpenter cc: Joe Perches , James Smart , kernel-janitors@vger.kernel.org, Dick Kennedy , "James E.J. Bottomley" , "Martin K. Petersen" , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Harshit Mogalapalli , Kees Cook Subject: Re: [PATCH 4/6] scsi: lpfc: use kzalloc In-Reply-To: <20220314113407.GM3293@kadam> Message-ID: References: <20220312102705.71413-1-Julia.Lawall@inria.fr> <20220312102705.71413-5-Julia.Lawall@inria.fr> <846e22e76ba9e4c620df159b073bbf4e058a35f0.camel@perches.com> <20220314113407.GM3293@kadam> User-Agent: Alpine 2.22 (DEB 394 2020-01-19) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 14 Mar 2022, Dan Carpenter wrote: > On Sat, Mar 12, 2022 at 01:45:01PM -0800, Joe Perches wrote: > > On Sat, 2022-03-12 at 11:27 +0100, Julia Lawall wrote: > > > Use kzalloc instead of kmalloc + memset. > > [] > > > diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c b/drivers/scsi/lpfc/lpfc_debugfs.c > > [] > > > @@ -6272,10 +6272,8 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport) > > > phba->hba_debugfs_root, > > > phba, &lpfc_debugfs_op_slow_ring_trc); > > > if (!phba->slow_ring_trc) { > > > - phba->slow_ring_trc = kmalloc( > > > - (sizeof(struct lpfc_debugfs_trc) * > > > - lpfc_debugfs_max_slow_ring_trc), > > > - GFP_KERNEL); > > > + phba->slow_ring_trc = kzalloc((sizeof(struct lpfc_debugfs_trc) * lpfc_debugfs_max_slow_ring_trc), > > > + GFP_KERNEL); > > > > kcalloc > > > > Did someone have a Coccinelle script that converted kzalloc() to > kcalloc()? Not sure if I have ever done that. A long time ago, I made one that starts with kmalloc and picks kzalloc or kcalloc. Perhaps Kees did such a thing? I'll see if it would be useful. julia