]> git.droids-corp.org - dpdk.git/commitdiff
common/cnxk: fix null pointer dereference
authorGowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
Sun, 24 Apr 2022 16:17:23 +0000 (21:47 +0530)
committerJerin Jacob <jerinj@marvell.com>
Thu, 5 May 2022 08:10:17 +0000 (10:10 +0200)
Fix null pointer dereference reported in coverity scan.

Coverity issue: 372065
Fixes: 665b6a7400b ("common/cnxk: add NPC helper API")
Cc: stable@dpdk.org
Signed-off-by: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
drivers/common/cnxk/roc_npc_utils.c

index 0d02872c8bd2a94a37acd0f40997c100daefde66..e36a312576f519003c312b1c10b8122ea16110fb 100644 (file)
@@ -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
         */