From: Pablo de Lara Date: Wed, 15 Jul 2015 12:40:41 +0000 (+0100) Subject: hash: fix out of bounds array access X-Git-Tag: spdx-start~8729 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=2a4103eba929e67e0f0eb9dc808da26377fe2665;p=dpdk.git hash: fix out of bounds array access 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 --- diff --git a/lib/librte_hash/rte_cuckoo_hash.c b/lib/librte_hash/rte_cuckoo_hash.c index 39cafb700f..105ecdb68a 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;