diff mbox series

event/dlb: fix potential NULL dereference

Message ID 1605548439-31240-1-git-send-email-timothy.mcdaniel@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Jerin Jacob
Headers show
Series event/dlb: fix potential NULL dereference | expand

Checks

Context Check Description
ci/iol-mellanox-Performance success Performance Testing PASS
ci/travis-robot success Travis build: passed
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-testing success Testing PASS
ci/iol-intel-Functional fail Functional Testing issues
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/Intel-compilation success Compilation OK
ci/checkpatch success coding style OK

Commit Message

McDaniel, Timothy Nov. 16, 2020, 5:40 p.m. UTC
Add NULL check before using t->mbuf_pool.

Coverity issue: 363719
Fixes: 83326 ("event/dlb: add PMD self-tests")

Signed-off-by: Timothy McDaniel <timothy.mcdaniel@intel.com>
---
 drivers/event/dlb/dlb_selftest.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Mcnamara, John Nov. 20, 2020, 10:03 a.m. UTC | #1
> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Timothy McDaniel
> Sent: Monday, November 16, 2020 5:41 PM
> Cc: dev@dpdk.org; Carrillo, Erik G <erik.g.carrillo@intel.com>; Eads, Gage
> <gage.eads@intel.com>; Van Haaren, Harry <harry.van.haaren@intel.com>;
> jerinj@marvell.com; thomas@monjalon.net
> Subject: [dpdk-dev] [PATCH] event/dlb: fix potential NULL dereference
> 
> Add NULL check before using t->mbuf_pool.
> 
> Coverity issue: 363719
> Fixes: 83326 ("event/dlb: add PMD self-tests")

This is similar to a fix on the dlb2 driver which fixed a similar Coverity defect (according to the last Coverity run). So, on that basis, I'll ack this patch.

Jerin, could you try merge this for RC5 if possible.


Acked-by: John McNamara <john.mcnamara@intel.com>
Jerin Jacob Nov. 20, 2020, 12:25 p.m. UTC | #2
On Fri, Nov 20, 2020 at 3:33 PM Mcnamara, John <john.mcnamara@intel.com> wrote:
>
>
>
> > -----Original Message-----
> > From: dev <dev-bounces@dpdk.org> On Behalf Of Timothy McDaniel
> > Sent: Monday, November 16, 2020 5:41 PM
> > Cc: dev@dpdk.org; Carrillo, Erik G <erik.g.carrillo@intel.com>; Eads, Gage
> > <gage.eads@intel.com>; Van Haaren, Harry <harry.van.haaren@intel.com>;
> > jerinj@marvell.com; thomas@monjalon.net
> > Subject: [dpdk-dev] [PATCH] event/dlb: fix potential NULL dereference
> >
> > Add NULL check before using t->mbuf_pool.
> >
> > Coverity issue: 363719
> > Fixes: 83326 ("event/dlb: add PMD self-tests")
>
> This is similar to a fix on the dlb2 driver which fixed a similar Coverity defect (according to the last Coverity run). So, on that basis, I'll ack this patch.
>
> Jerin, could you try merge this for RC5 if possible.
>


Applied to dpdk-next-net-eventdev/for-main. Thanks


>
> Acked-by: John McNamara <john.mcnamara@intel.com>
>
>
diff mbox series

Patch

diff --git a/drivers/event/dlb/dlb_selftest.c b/drivers/event/dlb/dlb_selftest.c
index b9ef778c1..8ab00ba87 100644
--- a/drivers/event/dlb/dlb_selftest.c
+++ b/drivers/event/dlb/dlb_selftest.c
@@ -202,7 +202,12 @@  test_stop_flush(struct test *t) /* test to check we can properly flush events */
 		goto err;
 	}
 
-	count = rte_mempool_avail_count(t->mbuf_pool);
+	if (t->mbuf_pool)
+		count = rte_mempool_avail_count(t->mbuf_pool);
+	else {
+		printf("%d: mbuf_pool is NULL\n", __LINE__);
+		goto err;
+	}
 
 	if (rte_event_port_attr_get(evdev,
 				    0,