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 89F525947 for ; Wed, 15 Jul 2015 14:40:46 +0200 (CEST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga101.fm.intel.com with ESMTP; 15 Jul 2015 05:40:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,480,1432623600"; d="scan'208";a="524709479" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by FMSMGA003.fm.intel.com with ESMTP; 15 Jul 2015 05:40:44 -0700 Received: from sivswdev02.ir.intel.com (sivswdev02.ir.intel.com [10.237.217.46]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id t6FCehJv012566 for ; Wed, 15 Jul 2015 13:40:44 +0100 Received: from sivswdev02.ir.intel.com (localhost [127.0.0.1]) by sivswdev02.ir.intel.com with ESMTP id t6FCehw5005766 for ; Wed, 15 Jul 2015 13:40:43 +0100 Received: (from pdelarax@localhost) by sivswdev02.ir.intel.com with id t6FCehSR005762 for dev@dpdk.org; Wed, 15 Jul 2015 13:40:43 +0100 From: Pablo de Lara To: dev@dpdk.org Date: Wed, 15 Jul 2015 13:40:41 +0100 Message-Id: <1436964043-5729-1-git-send-email-pablo.de.lara.guarch@intel.com> X-Mailer: git-send-email 1.7.4.1 Subject: [dpdk-dev] [PATCH] hash: fix array out of bounds in hash library 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: Wed, 15 Jul 2015 12:40:47 -0000 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 --- 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