From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 248A0A034E; Sat, 12 Feb 2022 13:38:42 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 127294117D; Sat, 12 Feb 2022 13:38:40 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 09CC44118F for ; Sat, 12 Feb 2022 13:38:37 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 21CBs89r000545 for ; Sat, 12 Feb 2022 04:38:37 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=tv/E1QmIKfqJsX1bgMK267vb+dxGEy3RJok1oTQiOKo=; b=PWMY1YbCVKxcdyo2RzpJdShsRSaEGowLf622UhFeWwxa8Qa+CPw0Eh8h5x+jQlGQ2Rbx x2qA5utzCfNWDL29FcOauMGRhJ7apDd/vbbZpHUakS5cziHBGasTeKz1Ba2gIxm50XNe /7qHAvm46IKS5STCcdv3Pu4xRmJNPvV9+hdKda5LC28MNeKaU8ywWUneLjB1PvHYgFmu vHw7rm/4xkshs5pCDSZsjSGIUttvyPjVOTegA3Mii9dr6DmYwd/XGlrexCbkn9sXv2FA A9KmouVMdjIv0+Yxa0TLgzJEUrxmY3w8HgZnOoJKIPdmJbuuT3I2vDCww3xNLAz5v4vo JQ== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3e6b4rr8jk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Sat, 12 Feb 2022 04:38:37 -0800 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Sat, 12 Feb 2022 04:38:35 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Sat, 12 Feb 2022 04:38:35 -0800 Received: from localhost.localdomain (unknown [10.28.34.38]) by maili.marvell.com (Postfix) with ESMTP id 78B625B6941; Sat, 12 Feb 2022 04:38:33 -0800 (PST) From: Gowrishankar Muthukrishnan To: CC: Nithin Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao , , Gowrishankar Muthukrishnan Subject: [PATCH 3/3] common/cnxk: fix uninitialized pointer read Date: Sat, 12 Feb 2022 18:08:20 +0530 Message-ID: <20220212123820.3394341-3-gmuthukrishn@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220212123820.3394341-1-gmuthukrishn@marvell.com> References: <20220212123820.3394341-1-gmuthukrishn@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-ORIG-GUID: dSRZMdimqehxesvW9Dwo5b09Z7FPPPnk X-Proofpoint-GUID: dSRZMdimqehxesvW9Dwo5b09Z7FPPPnk X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-02-12_04,2022-02-11_01,2021-12-02_01 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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 --- 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