Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1627877 > unrolled thread
| Started by | kbuild test robot <fengguang.wu@intel.com> |
|---|---|
| First post | 2017-04-21 02:30 +0200 |
| Last post | 2017-04-24 18:10 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH] qed: fix kzalloc-simple.cocci warnings kbuild test robot <fengguang.wu@intel.com> - 2017-04-21 02:30 +0200
Re: [PATCH] qed: fix kzalloc-simple.cocci warnings David Miller <davem@davemloft.net> - 2017-04-24 18:10 +0200
| From | kbuild test robot <fengguang.wu@intel.com> |
|---|---|
| Date | 2017-04-21 02:30 +0200 |
| Subject | [PATCH] qed: fix kzalloc-simple.cocci warnings |
| Message-ID | <tyuCu-7kS-11@gated-at.bofh.it> |
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;
[toc] | [next] | [standalone]
| From | David Miller <davem@davemloft.net> |
|---|---|
| Date | 2017-04-24 18:10 +0200 |
| Message-ID | <tzOIQ-JE-59@gated-at.bofh.it> |
| In reply to | #1627877 |
From: kbuild test robot <fengguang.wu@intel.com> Date: Fri, 21 Apr 2017 08:20:07 +0800 > 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> I intentionally let this change happen. It was less risky than asking the submitter who introduced it to make another respin to keep the kzalloc().
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web