From: kbuild test robot <fengguang.wu@intel.com>
To: "sudarsana.kalluru@cavium.com" <sudarsana.kalluru@cavium.com>
Cc: kbuild-all@01.org, netdev@vger.kernel.org,
Sudarsana Reddy Kalluru <Sudarsana.Kalluru@cavium.com>,
Yuval Mintz <Yuval.Mintz@cavium.com>,
Ariel Elior <Ariel.Elior@cavium.com>,
everest-linux-l2@cavium.com, linux-kernel@vger.kernel.org
Subject: [PATCH] qed: fix kzalloc-simple.cocci warnings
Date: Fri, 21 Apr 2017 08:20:07 +0800 [thread overview]
Message-ID: <20170421002007.GA8379@lkp-sbx04> (raw)
In-Reply-To: <201704210853.tUPLU4Mh%fengguang.wu@intel.com>
drivers/net/ethernet/qlogic/qed/qed_dcbx.c:1267:13-20: WARNING: kzalloc should be used for dcbx_info, 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: sudarsana.kalluru@cavium.com <sudarsana.kalluru@cavium.com>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
---
qed_dcbx.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
--- a/drivers/net/ethernet/qlogic/qed/qed_dcbx.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_dcbx.c
@@ -1264,11 +1264,10 @@ static struct qed_dcbx_get *qed_dcbnl_ge
{
struct qed_dcbx_get *dcbx_info;
- dcbx_info = kmalloc(sizeof(*dcbx_info), GFP_ATOMIC);
+ dcbx_info = kzalloc(sizeof(*dcbx_info), GFP_ATOMIC);
if (!dcbx_info)
return NULL;
- memset(dcbx_info, 0, sizeof(*dcbx_info));
if (qed_dcbx_query_params(hwfn, dcbx_info, type)) {
kfree(dcbx_info);
return NULL;
next parent reply other threads:[~2017-04-21 0:20 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <201704210853.tUPLU4Mh%fengguang.wu@intel.com>
2017-04-21 0:20 ` kbuild test robot [this message]
2017-04-24 16:03 ` David Miller
[not found] <201609011409.GGSqCknq%fengguang.wu@intel.com>
2016-09-01 6:45 ` kbuild test robot
2016-09-01 7:37 ` Yuval Mintz
2016-09-01 16:48 ` David Miller
2016-09-02 17:44 ` Joe Perches
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=20170421002007.GA8379@lkp-sbx04 \
--to=fengguang.wu@intel.com \
--cc=Ariel.Elior@cavium.com \
--cc=Yuval.Mintz@cavium.com \
--cc=everest-linux-l2@cavium.com \
--cc=kbuild-all@01.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=sudarsana.kalluru@cavium.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®