From: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
To: <dev@dpdk.org>
Cc: Nithin Dabilpuram <ndabilpuram@marvell.com>,
Kiran Kumar K <kirankumark@marvell.com>,
Sunil Kumar Kori <skori@marvell.com>,
Satha Rao <skoteshwar@marvell.com>, <jerinj@marvell.com>,
Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
Subject: [PATCH 3/3] common/cnxk: fix uninitialized pointer read
Date: Sat, 12 Feb 2022 18:08:20 +0530 [thread overview]
Message-ID: <20220212123820.3394341-3-gmuthukrishn@marvell.com> (raw)
In-Reply-To: <20220212123820.3394341-1-gmuthukrishn@marvell.com>
Fix uninitialized pointer read reported in coverity scan.
Fixes: c34ea71b878 ("common/cnxk: add NPC parsing API")
Coverity issue: 370214, 370217, 370219, 370220, 370221, 370223,
370224, 370225, 372065
Signed-off-by: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
---
drivers/common/cnxk/roc_npc_parse.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/drivers/common/cnxk/roc_npc_parse.c b/drivers/common/cnxk/roc_npc_parse.c
index 1f21693369..41ff0fcc6b 100644
--- a/drivers/common/cnxk/roc_npc_parse.c
+++ b/drivers/common/cnxk/roc_npc_parse.c
@@ -112,6 +112,7 @@ npc_parse_cpt_hdr(struct npc_parse_state *pst)
info.hw_hdr_len = 0;
/* Prepare for parsing the item */
+ info.def_mask = NULL;
info.hw_mask = &hw_mask;
info.len = pst->pattern->size;
npc_get_hw_supp_mask(pst, &info, lid, lt);
@@ -149,6 +150,7 @@ npc_parse_higig2_hdr(struct npc_parse_state *pst)
}
/* Prepare for parsing the item */
+ info.def_mask = NULL;
info.hw_mask = &hw_mask;
info.len = pst->pattern->size;
npc_get_hw_supp_mask(pst, &info, lid, lt);
@@ -198,6 +200,7 @@ npc_parse_la(struct npc_parse_state *pst)
}
/* Prepare for parsing the item */
+ info.def_mask = NULL;
info.hw_mask = &hw_mask;
info.len = sizeof(eth_item->hdr);
npc_get_hw_supp_mask(pst, &info, lid, lt);
@@ -236,6 +239,7 @@ npc_parse_lb(struct npc_parse_state *pst)
int nr_vlans = 0;
int rc;
+ info.def_mask = NULL;
info.spec = NULL;
info.mask = NULL;
info.def_mask = NULL;
@@ -396,12 +400,12 @@ npc_parse_mpls_label_stack(struct npc_parse_state *pst, int *flag)
* pst->pattern points to first MPLS label. We only check
* that subsequent labels do not have anything to match.
*/
+ info.def_mask = NULL;
info.hw_mask = NULL;
info.len = pattern->size;
info.spec = NULL;
info.mask = NULL;
info.hw_hdr_len = 0;
- info.def_mask = NULL;
while (pattern->type == ROC_NPC_ITEM_TYPE_MPLS) {
nr_labels++;
@@ -447,6 +451,7 @@ npc_parse_mpls(struct npc_parse_state *pst, int lid)
info.len = pst->pattern->size;
info.spec = NULL;
info.mask = NULL;
+ info.def_mask = NULL;
info.hw_hdr_len = 0;
npc_get_hw_supp_mask(pst, &info, lid, lt);
@@ -547,6 +552,7 @@ npc_parse_lc(struct npc_parse_state *pst)
if (pst->pattern->type == ROC_NPC_ITEM_TYPE_MPLS)
return npc_parse_mpls(pst, NPC_LID_LC);
+ info.def_mask = NULL;
info.hw_mask = &hw_mask;
info.spec = NULL;
info.mask = NULL;
@@ -638,10 +644,10 @@ npc_parse_ld(struct npc_parse_state *pst)
return npc_parse_mpls(pst, NPC_LID_LD);
return 0;
}
+ info.def_mask = NULL;
info.hw_mask = &hw_mask;
info.spec = NULL;
info.mask = NULL;
- info.def_mask = NULL;
info.len = 0;
info.hw_hdr_len = 0;
@@ -797,6 +803,7 @@ npc_parse_lf(struct npc_parse_state *pst)
lflags = 0;
/* No match support for vlan tags */
+ info.def_mask = NULL;
info.hw_mask = NULL;
info.len = pst->pattern->size;
info.spec = NULL;
@@ -855,6 +862,7 @@ npc_parse_lg(struct npc_parse_state *pst)
if (!pst->tunnel)
return 0;
+ info.def_mask = NULL;
info.hw_mask = &hw_mask;
info.spec = NULL;
info.mask = NULL;
@@ -891,6 +899,7 @@ npc_parse_lh(struct npc_parse_state *pst)
if (!pst->tunnel)
return 0;
+ info.def_mask = NULL;
info.hw_mask = &hw_mask;
info.spec = NULL;
info.mask = NULL;
--
2.25.1
next prev parent reply other threads:[~2022-02-12 12:38 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-12 12:38 [PATCH 1/3] common/cnxk: check return value for error Gowrishankar Muthukrishnan
2022-02-12 12:38 ` [PATCH 2/3] common/cnx: fix unintended sign extension Gowrishankar Muthukrishnan
2022-02-12 12:38 ` Gowrishankar Muthukrishnan [this message]
2022-02-18 4:20 ` [PATCH 1/3] common/cnxk: check return value for error Jerin Jacob
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=20220212123820.3394341-3-gmuthukrishn@marvell.com \
--to=gmuthukrishn@marvell.com \
--cc=dev@dpdk.org \
--cc=jerinj@marvell.com \
--cc=kirankumark@marvell.com \
--cc=ndabilpuram@marvell.com \
--cc=skori@marvell.com \
--cc=skoteshwar@marvell.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;
as well as URLs for NNTP newsgroup(s).