From: Xavier Simonart <xavier.simonart@intel.com>
To: dev@dpdk.org, xavier.simonart@intel.com
Subject: [dpdk-dev] [PATCH] hash: fix crash when adding already inserted keys
Date: Tue, 28 Jul 2015 16:54:39 +0200 [thread overview]
Message-ID: <1438095279-234959-1-git-send-email-xavier.simonart@intel.com> (raw)
When adding with cuckoo hash a key which was already inserted
a new slot is dequeued and then enqueued back, but the enqueue
operation was not done properly.
Signed-off-by: Xavier Simonart <xavier.simonart@intel.com>
---
lib/librte_hash/rte_cuckoo_hash.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/librte_hash/rte_cuckoo_hash.c b/lib/librte_hash/rte_cuckoo_hash.c
index 5cf4af6..4da859a 100644
--- a/lib/librte_hash/rte_cuckoo_hash.c
+++ b/lib/librte_hash/rte_cuckoo_hash.c
@@ -509,7 +509,7 @@ __rte_hash_add_key_with_hash(const struct rte_hash *h, const void *key,
k = (struct rte_hash_key *) ((char *)keys +
prim_bkt->key_idx[i] * h->key_entry_size);
if (h->rte_hash_cmp_eq(key, k->key, h->key_len) == 0) {
- rte_ring_sp_enqueue(h->free_slots, &slot_id);
+ rte_ring_sp_enqueue(h->free_slots, slot_id);
/* Update data */
k->pdata = data;
/*
@@ -528,7 +528,7 @@ __rte_hash_add_key_with_hash(const struct rte_hash *h, const void *key,
k = (struct rte_hash_key *) ((char *)keys +
sec_bkt->key_idx[i] * h->key_entry_size);
if (h->rte_hash_cmp_eq(key, k->key, h->key_len) == 0) {
- rte_ring_sp_enqueue(h->free_slots, &slot_id);
+ rte_ring_sp_enqueue(h->free_slots, slot_id);
/* Update data */
k->pdata = data;
/*
--
1.8.3.1
next reply other threads:[~2015-07-28 15:02 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-28 14:54 Xavier Simonart [this message]
2015-07-28 15:07 ` Gonzalez Monroy, Sergio
2015-07-28 17:35 ` 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=1438095279-234959-1-git-send-email-xavier.simonart@intel.com \
--to=xavier.simonart@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).