DPDK patches and discussions
 help / color / mirror / Atom feed
From: Liang Ma <liang.j.ma@intel.com>
To: dev@dpdk.org
Cc: harry.van.haaren@intel.com, bruce.richardson@intel.com,
	peter.mccarthy@intel.com, jerin.jacob@caviumnetworks.com
Subject: [dpdk-dev] [PATCH 2/2] event/opdl: fix dereference before null check
Date: Wed, 24 Jan 2018 15:05:51 +0000	[thread overview]
Message-ID: <1516806351-151804-2-git-send-email-liang.j.ma@intel.com> (raw)
In-Reply-To: <1516806351-151804-1-git-send-email-liang.j.ma@intel.com>

Fixes: 4236ce9bf5bf ("event/opdl: add OPDL ring infrastructure library")
Coverity issue: 257022

Signed-off-by: Liang Ma <liang.j.ma@intel.com>
---
 drivers/event/opdl/opdl_ring.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/event/opdl/opdl_ring.c b/drivers/event/opdl/opdl_ring.c
index 7e16d4d..39dc41d 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;
 }
-- 
2.7.5

  reply	other threads:[~2018-01-24 15:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-24 15:05 [dpdk-dev] [PATCH 1/2] event/opdl: fix the resource leak issue Liang Ma
2018-01-24 15:05 ` Liang Ma [this message]
2018-01-31  9:43 ` Jerin Jacob

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1516806351-151804-2-git-send-email-liang.j.ma@intel.com \
    --to=liang.j.ma@intel.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=harry.van.haaren@intel.com \
    --cc=jerin.jacob@caviumnetworks.com \
    --cc=peter.mccarthy@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).