event/dlb: fix potential NULL dereference
Checks
Commit Message
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
> -----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>
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>
>
>
@@ -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,