DPDK patches and discussions
 help / color / mirror / Atom feed
From: Pablo de Lara <pablo.de.lara.guarch@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH] hash: fix array out of bounds in hash library
Date: Wed, 15 Jul 2015 13:40:41 +0100	[thread overview]
Message-ID: <1436964043-5729-1-git-send-email-pablo.de.lara.guarch@intel.com> (raw)

When encountering a loop while adding a new entry,
element out of bounds of array was being unnecessarily resetted.

Fixes: 48a399119619 ("hash: replace with cuckoo hash implementation")

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---
 lib/librte_hash/rte_cuckoo_hash.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/lib/librte_hash/rte_cuckoo_hash.c b/lib/librte_hash/rte_cuckoo_hash.c
index 93f94a5..b753e77 100644
--- a/lib/librte_hash/rte_cuckoo_hash.c
+++ b/lib/librte_hash/rte_cuckoo_hash.c
@@ -446,11 +446,8 @@ make_space_bucket(const struct rte_hash *h, struct rte_hash_bucket *bkt)
 			break;
 
 	/* All entries have been pushed, so entry cannot be added */
-	if (i == RTE_HASH_BUCKET_ENTRIES) {
-		/* Reset flag */
-		bkt->flag[i] = 0;
+	if (i == RTE_HASH_BUCKET_ENTRIES)
 		return -ENOSPC;
-	}
 
 	/* Set flag to indicate that this entry is going to be pushed */
 	bkt->flag[i] = 1;
-- 
2.4.2

             reply	other threads:[~2015-07-15 12:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-15 12:40 Pablo de Lara [this message]
2015-07-15 12:40 ` [dpdk-dev] [PATCH] hash: fix compilation for gcc 4.4/4.5 Pablo de Lara
2015-07-16 14:55   ` Thomas Monjalon
2015-07-15 12:40 ` [dpdk-dev] [PATCH] hash: fix library compilation for CPU with no SSE4.1 Pablo de Lara
2015-07-16 14:55 ` [dpdk-dev] [PATCH] hash: fix array out of bounds in hash library Thomas Monjalon

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=1436964043-5729-1-git-send-email-pablo.de.lara.guarch@intel.com \
    --to=pablo.de.lara.guarch@intel.com \
    --cc=dev@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).