From: kbuild test robot <lkp@intel.com>
To: Cathy Avery <cavery@redhat.com>
Cc: kbuild-all@01.org, kys@microsoft.com, haiyangz@microsoft.com,
jejb@linux.vnet.ibm.com, martin.petersen@oracle.com,
devel@linuxdriverproject.org, linux-kernel@vger.kernel.org,
linux-scsi@vger.kernel.org
Subject: [PATCH] storvsc: fix kzalloc-simple.cocci warnings
Date: Wed, 23 Nov 2016 10:56:24 +0800 [thread overview]
Message-ID: <20161123025624.GA123019@ivytown2.lkp.intel.com> (raw)
In-Reply-To: <1479836185-6741-1-git-send-email-cavery@redhat.com>
drivers/scsi/storvsc_drv.c:1500:13-20: WARNING: kzalloc should be used for payload, instead of kmalloc/memset
Use kzalloc rather than kmalloc followed by memset with 0
This considers some simple cases that are common and easy to validate
Note in particular that there are no ...s in the rule, so all of the
matched code has to be contiguous
Generated by: scripts/coccinelle/api/alloc/kzalloc-simple.cocci
CC: Cathy Avery <cavery@redhat.com>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
---
storvsc_drv.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
--- a/drivers/scsi/storvsc_drv.c
+++ b/drivers/scsi/storvsc_drv.c
@@ -1497,10 +1497,9 @@ static int storvsc_queuecommand(struct S
payload_sz = (sg_count * sizeof(u64) +
sizeof(struct vmbus_packet_mpb_array));
- payload = kmalloc(payload_sz, GFP_ATOMIC);
+ payload = kzalloc(payload_sz, GFP_ATOMIC);
if (!payload)
return SCSI_MLQUEUE_DEVICE_BUSY;
- memset(payload, 0, payload_sz);
}
payload->range.len = length;
prev parent reply other threads:[~2016-11-23 2:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-22 17:36 [PATCH] [hv] storvsc: Payload buffer incorrectly sized for 32 bit kernels Cathy Avery
2016-11-23 2:56 ` kbuild test robot
2016-11-23 2:56 ` kbuild test robot [this message]
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=20161123025624.GA123019@ivytown2.lkp.intel.com \
--to=lkp@intel.com \
--cc=cavery@redhat.com \
--cc=devel@linuxdriverproject.org \
--cc=haiyangz@microsoft.com \
--cc=jejb@linux.vnet.ibm.com \
--cc=kbuild-all@01.org \
--cc=kys@microsoft.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®