DPDK patches and discussions
 help / color / mirror / Atom feed
From: Emmanuel Roullit <emmanuel.roullit@gmail.com>
To: cristian.dumitrescu@intel.com
Cc: dev@dpdk.org, stable@dpdk.org
Subject: [dpdk-dev] [PATCH] rte_table: ensure prev bucket has a valid pointer
Date: Tue, 24 Jan 2017 21:38:30 +0100	[thread overview]
Message-ID: <20170124203830.5691-1-emmanuel.roullit@gmail.com> (raw)

Fixes: 43f15e28377f ("table: fix verification on hash bucket header alignment")

Signed-off-by: Emmanuel Roullit <emmanuel.roullit@gmail.com>
---
 lib/librte_table/rte_table_hash_key16.c | 7 +++++--
 lib/librte_table/rte_table_hash_key32.c | 7 +++++--
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/lib/librte_table/rte_table_hash_key16.c b/lib/librte_table/rte_table_hash_key16.c
index 08d4d77eb..9c04e7f5e 100644
--- a/lib/librte_table/rte_table_hash_key16.c
+++ b/lib/librte_table/rte_table_hash_key16.c
@@ -483,8 +483,11 @@ rte_table_hash_entry_add_key16_ext(
 
 		bucket = (struct rte_bucket_4_16 *) &f->memory[(f->n_buckets +
 			bucket_index) * f->bucket_size];
-		bucket_prev->next = bucket;
-		bucket_prev->next_valid = 1;
+
+		if (bucket_prev) {
+			bucket_prev->next = bucket;
+			bucket_prev->next_valid = 1;
+		}
 
 		bucket->signature[0] = signature;
 		memcpy(bucket->key[0], key, f->key_size);
diff --git a/lib/librte_table/rte_table_hash_key32.c b/lib/librte_table/rte_table_hash_key32.c
index 161f6b7a7..27e221be9 100644
--- a/lib/librte_table/rte_table_hash_key32.c
+++ b/lib/librte_table/rte_table_hash_key32.c
@@ -471,8 +471,11 @@ rte_table_hash_entry_add_key32_ext(
 		bucket = (struct rte_bucket_4_32 *)
 			&f->memory[(f->n_buckets + bucket_index) *
 			f->bucket_size];
-		bucket_prev->next = bucket;
-		bucket_prev->next_valid = 1;
+
+		if (bucket_prev) {
+			bucket_prev->next = bucket;
+			bucket_prev->next_valid = 1;
+		}
 
 		bucket->signature[0] = signature;
 		memcpy(bucket->key[0], key, f->key_size);
-- 
2.11.0

             reply	other threads:[~2017-01-24 20:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-24 20:38 Emmanuel Roullit [this message]
2017-01-24 21:43 ` Dumitrescu, Cristian
2017-02-14 19:07 ` Dumitrescu, Cristian

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=20170124203830.5691-1-emmanuel.roullit@gmail.com \
    --to=emmanuel.roullit@gmail.com \
    --cc=cristian.dumitrescu@intel.com \
    --cc=dev@dpdk.org \
    --cc=stable@dpdk.org \
    /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).