From: Liang Ma Date: Wed, 24 Jan 2018 15:05:51 +0000 (+0000) Subject: event/opdl: fix dereference before null check X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=8545289a2912bdfab2c4ddf6cc5e134f72677b13;p=dpdk.git event/opdl: fix dereference before null check Coverity issue: 257022 Fixes: 4236ce9bf5bf ("event/opdl: add OPDL ring infrastructure library") Signed-off-by: Liang Ma --- diff --git a/drivers/event/opdl/opdl_ring.c b/drivers/event/opdl/opdl_ring.c index 7e16d4df1b..39dc41da96 100644 --- a/drivers/event/opdl/opdl_ring.c +++ b/drivers/event/opdl/opdl_ring.c @@ -550,6 +550,10 @@ opdl_stage_claim_multithread(struct opdl_stage *s, void *entries, uint32_t i = 0, offset; uint8_t *entries_offset = (uint8_t *)entries; + if (seq == NULL) { + PMD_DRV_LOG(ERR, "Invalid seq PTR"); + return 0; + } offset = opdl_first_entry_id(*seq, s->nb_instance, s->instance_id); num_entries = offset + (s->nb_instance * num_entries); @@ -561,8 +565,8 @@ opdl_stage_claim_multithread(struct opdl_stage *s, void *entries, entries_offset += t->slot_size; i++; } - if (seq != NULL) - *seq = old_head; + + *seq = old_head; return i; }