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 X-Spam-Level: X-Spam-Status: No, score=-10.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5F0FBC2BA2B for ; Sun, 12 Apr 2020 15:45:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 36AE6206E5 for ; Sun, 12 Apr 2020 15:45:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726955AbgDLPpG (ORCPT ); Sun, 12 Apr 2020 11:45:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.18]:45030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726843AbgDLPpF (ORCPT ); Sun, 12 Apr 2020 11:45:05 -0400 Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D9017C0A3BF0 for ; Sun, 12 Apr 2020 08:39:19 -0700 (PDT) X-IronPort-AV: E=Sophos;i="5.72,374,1580770800"; d="scan'208";a="345718601" Received: from abo-173-121-68.mrs.modulonet.fr (HELO hadrien) ([85.68.121.173]) by mail3-relais-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Apr 2020 17:39:18 +0200 Date: Sun, 12 Apr 2020 17:39:17 +0200 (CEST) From: Julia Lawall X-X-Sender: jll@hadrien To: James Smart cc: linux-scsi@vger.kernel.org, dwagner@suse.de, maier@linux.ibm.com, bvanassche@acm.org, herbszt@gmx.de, natechancellor@gmail.com, rdunlap@infradead.org, hare@suse.de, James Smart , Ram Vegesna , kbuild-all@lists.01.org Subject: [PATCH] elx: efct: fix zalloc-simple.cocci warnings Message-ID: User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Use zeroing allocator rather than allocator followed by memset with 0 Generated by: scripts/coccinelle/api/alloc/zalloc-simple.cocci CC: James Smart Signed-off-by: kbuild test robot Signed-off-by: Julia Lawall --- url: https://github.com/0day-ci/linux/commits/James-Smart/efct-Broadcom-Emulex-FC-Target-driver/20200412-114125 base: https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next :::::: branch date: 4 hours ago :::::: commit date: 4 hours ago efct_lio.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) --- a/drivers/scsi/elx/efct/efct_lio.c +++ b/drivers/scsi/elx/efct/efct_lio.c @@ -262,11 +262,10 @@ static int efct_debugfs_session_open(str return EFC_SUCCESS; } - filp->private_data = kmalloc(size, GFP_KERNEL); + filp->private_data = kzalloc(size, GFP_KERNEL); if (!filp->private_data) return -ENOMEM; - memset(filp->private_data, 0, size); efct_lio_tgt_session_data(sport->efct, sport->wwpn, filp->private_data, size); return EFC_SUCCESS; @@ -300,11 +299,10 @@ static int efct_npiv_debugfs_session_ope return EFC_SUCCESS; } - filp->private_data = kmalloc(size, GFP_KERNEL); + filp->private_data = kzalloc(size, GFP_KERNEL); if (!filp->private_data) return -ENOMEM; - memset(filp->private_data, 0, size); efct_lio_tgt_session_data(sport->efct, sport->npiv_wwpn, filp->private_data, size); return EFC_SUCCESS; @@ -1459,11 +1457,10 @@ int efct_scsi_del_initiator(struct efc * if (reason == EFCT_SCSI_INITIATOR_MISSING) return EFCT_SCSI_CALL_COMPLETE; - wq_data = kmalloc(sizeof(*wq_data), GFP_ATOMIC); + wq_data = kzalloc(sizeof(*wq_data), GFP_ATOMIC); if (!wq_data) return EFCT_SCSI_CALL_COMPLETE; - memset(wq_data, 0, sizeof(*wq_data)); wq_data->ptr = node; wq_data->efct = efct; INIT_WORK(&wq_data->work, efct_lio_remove_session);