From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 00E4C2C07 for ; Tue, 4 Oct 2016 09:15:28 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP; 04 Oct 2016 00:15:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,442,1473145200"; d="scan'208";a="1060147628" Received: from sie-lab-214-036.ir.intel.com (HELO silpixa00394365.ir.intel.com) ([10.237.214.36]) by orsmga002.jf.intel.com with ESMTP; 04 Oct 2016 00:15:26 -0700 From: Pablo de Lara To: dev@dpdk.org Cc: bruce.richardson@intel.com, Pablo de Lara Date: Tue, 4 Oct 2016 08:16:34 +0100 Message-Id: <1475565394-184188-1-git-send-email-pablo.de.lara.guarch@intel.com> X-Mailer: git-send-email 2.7.4 Subject: [dpdk-dev] [PATCH] hash: fix incorrect free slot check X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Oct 2016 07:15:29 -0000 In function rte_hash_cuckoo_insert_mw_tm, while looking for an empty slot, only the first entry in the bucket was being checked, as key_idx array was not being iterated. Fixes: 5fc74c2e146d ("hash: check if slot is empty with key index") Reported-by: Bruce Richardson Signed-off-by: Pablo de Lara --- lib/librte_hash/rte_cuckoo_hash_x86.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/librte_hash/rte_cuckoo_hash_x86.h b/lib/librte_hash/rte_cuckoo_hash_x86.h index e16d69c..7ffa56f 100644 --- a/lib/librte_hash/rte_cuckoo_hash_x86.h +++ b/lib/librte_hash/rte_cuckoo_hash_x86.h @@ -53,7 +53,7 @@ rte_hash_cuckoo_insert_mw_tm(struct rte_hash_bucket *prim_bkt, */ for (i = 0; i < RTE_HASH_BUCKET_ENTRIES; i++) { /* Check if slot is available */ - if (likely(prim_bkt->key_idx == EMPTY_SLOT)) { + if (likely(prim_bkt->key_idx[i] == EMPTY_SLOT)) { prim_bkt->signatures[i].current = sig; prim_bkt->signatures[i].alt = alt_hash; prim_bkt->key_idx[i] = new_idx; -- 2.7.4