Fix null pointer dereference reported in coverity scan.

Coverity issue: 372065
Fixes: 665b6a7400b ("common/cnxk: add NPC helper API")

Signed-off-by: Gowrishankar Muthukrishnan <gmuthukri...@marvell.com>
---
 drivers/common/cnxk/roc_npc_utils.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/common/cnxk/roc_npc_utils.c 
b/drivers/common/cnxk/roc_npc_utils.c
index f9768ea3cf..dadd8826cb 100644
--- a/drivers/common/cnxk/roc_npc_utils.c
+++ b/drivers/common/cnxk/roc_npc_utils.c
@@ -145,6 +145,9 @@ npc_parse_item_basic(const struct roc_npc_item_info *item,
                        info->mask = item->mask;
        }
 
+       if (info->mask == NULL)
+               return NPC_ERR_INVALID_MASK;
+
        /* mask specified must be subset of hw supported mask
         * mask | hw_mask == hw_mask
         */
-- 
2.25.1

Reply via email to