Message ID | 1510775895-16258-1-git-send-email-gomonovych@gmail.com |
---|---|
State | Rejected, archived |
Delegated to: | David Miller |
Headers | show |
Series | qed: fix unnecessary call to memset cocci warnings | expand |
From: Vasyl Gomonovych <gomonovych@gmail.com> Date: Wed, 15 Nov 2017 20:58:15 +0100 > @@ -1277,11 +1277,10 @@ static struct qed_dcbx_get *qed_dcbnl_get_dcbx(struct qed_hwfn *hwfn, > { > struct qed_dcbx_get *dcbx_info; > > - dcbx_info = kmalloc(sizeof(*dcbx_info), GFP_ATOMIC); > + dcbx_info = kzmalloc(sizeof(*dcbx_info), GFP_ATOMIC); Thanks for not even compile testing your patch.
Sorry.
diff --git a/drivers/net/ethernet/qlogic/qed/qed_dcbx.c b/drivers/net/ethernet/qlogic/qed/qed_dcbx.c index 8f6ccc0c39e5..9a1bd996a640 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_dcbx.c +++ b/drivers/net/ethernet/qlogic/qed/qed_dcbx.c @@ -1277,11 +1277,10 @@ static struct qed_dcbx_get *qed_dcbnl_get_dcbx(struct qed_hwfn *hwfn, { struct qed_dcbx_get *dcbx_info; - dcbx_info = kmalloc(sizeof(*dcbx_info), GFP_ATOMIC); + dcbx_info = kzmalloc(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;
Use kzalloc rather than kmalloc followed by memset with 0 drivers/net/ethernet/qlogic/qed/qed_dcbx.c:1280:13-20: WARNING: kzalloc should be used for dcbx_info, instead of kmalloc/memset Generated by: scripts/coccinelle/api/alloc/kzalloc-simple.cocci Originally was fixed in: 'commit 561ed23331df ("qed: fix kzalloc-simple.cocci warnings")' But later warning was introduced in: 'commit 62289ba27558 ("qed: Fix possible system hang in the dcbnl-getdcbx() path.")' Signed-off-by: Vasyl Gomonovych <gomonovych@gmail.com> --- drivers/net/ethernet/qlogic/qed/qed_dcbx.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)