From: Julia Lawall <julia.lawall@inria.fr>
To: James Smart <jsmart2021@gmail.com>
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 <jsmart2021@gmail.com>,
Ram Vegesna <ram.vegesna@broadcom.com>,
kbuild-all@lists.01.org
Subject: [PATCH] elx: efct: fix zalloc-simple.cocci warnings
Date: Sun, 12 Apr 2020 17:39:17 +0200 (CEST) [thread overview]
Message-ID: <alpine.DEB.2.21.2004121738150.2419@hadrien> (raw)
Use zeroing allocator rather than allocator followed by memset with 0
Generated by: scripts/coccinelle/api/alloc/zalloc-simple.cocci
CC: James Smart <jsmart2021@gmail.com>
Signed-off-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Julia Lawall <julia.lawall@inria.fr>
---
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);
WARNING: multiple messages have this Message-ID (diff)
From: Julia Lawall <julia.lawall@inria.fr>
To: kbuild-all@lists.01.org
Subject: [PATCH] elx: efct: fix zalloc-simple.cocci warnings
Date: Sun, 12 Apr 2020 17:39:17 +0200 [thread overview]
Message-ID: <alpine.DEB.2.21.2004121738150.2419@hadrien> (raw)
[-- Attachment #1: Type: text/plain, Size: 1971 bytes --]
Use zeroing allocator rather than allocator followed by memset with 0
Generated by: scripts/coccinelle/api/alloc/zalloc-simple.cocci
CC: James Smart <jsmart2021@gmail.com>
Signed-off-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Julia Lawall <julia.lawall@inria.fr>
---
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);
next reply other threads:[~2020-04-12 15:45 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-12 15:39 Julia Lawall [this message]
2020-04-12 15:39 ` [PATCH] elx: efct: fix zalloc-simple.cocci warnings Julia Lawall
-- strict thread matches above, loose matches on Subject: below --
2020-04-12 15:40 Julia Lawall
2020-04-12 15:40 ` Julia Lawall
2020-04-12 15:38 Julia Lawall
2020-04-12 15:38 ` Julia Lawall
2020-04-12 15:33 Julia Lawall
2020-04-12 7:22 [PATCH v3 31/31] elx: efct: Tie into kernel Kconfig and build process kbuild test robot
2020-04-12 7:22 ` [PATCH] elx: efct: fix zalloc-simple.cocci warnings kbuild test robot
2020-04-12 7:22 ` kbuild test robot
2020-04-12 7:22 ` kbuild test robot
2020-04-12 7:22 ` kbuild test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.DEB.2.21.2004121738150.2419@hadrien \
--to=julia.lawall@inria.fr \
--cc=bvanassche@acm.org \
--cc=dwagner@suse.de \
--cc=hare@suse.de \
--cc=herbszt@gmx.de \
--cc=jsmart2021@gmail.com \
--cc=kbuild-all@lists.01.org \
--cc=linux-scsi@vger.kernel.org \
--cc=maier@linux.ibm.com \
--cc=natechancellor@gmail.com \
--cc=ram.vegesna@broadcom.com \
--cc=rdunlap@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.