[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170421002007.GA8379@lkp-sbx04>
Date: Fri, 21 Apr 2017 08:20:07 +0800
From: kbuild test robot <fengguang.wu@...el.com>
To: "sudarsana.kalluru@...ium.com" <sudarsana.kalluru@...ium.com>
Cc: kbuild-all@...org, netdev@...r.kernel.org,
Sudarsana Reddy Kalluru <Sudarsana.Kalluru@...ium.com>,
Yuval Mintz <Yuval.Mintz@...ium.com>,
Ariel Elior <Ariel.Elior@...ium.com>,
everest-linux-l2@...ium.com, linux-kernel@...r.kernel.org
Subject: [PATCH] qed: fix kzalloc-simple.cocci warnings
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@...ium.com <sudarsana.kalluru@...ium.com>
Signed-off-by: Fengguang Wu <fengguang.wu@...el.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;
Powered by blists - more mailing lists