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 76DC291C9 for ; Mon, 31 Aug 2015 15:30:08 +0200 (CEST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP; 31 Aug 2015 06:30:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,441,1437462000"; d="scan'208";a="779361820" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by fmsmga001.fm.intel.com with ESMTP; 31 Aug 2015 06:30:05 -0700 Received: from sivswdev01.ir.intel.com (sivswdev01.ir.intel.com [10.237.217.45]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id t7VDU4Zr011064; Mon, 31 Aug 2015 14:30:04 +0100 Received: from sivswdev01.ir.intel.com (localhost [127.0.0.1]) by sivswdev01.ir.intel.com with ESMTP id t7VDU4fA024802; Mon, 31 Aug 2015 14:30:04 +0100 Received: (from pdelarax@localhost) by sivswdev01.ir.intel.com with id t7VDU4c6024798; Mon, 31 Aug 2015 14:30:04 +0100 From: Pablo de Lara To: dev@dpdk.org Date: Mon, 31 Aug 2015 14:30:03 +0100 Message-Id: <1441027803-24765-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 wrong size memory calculation 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: Mon, 31 Aug 2015 13:30:08 -0000 When calculating the size for the table which allocates the keys, size was calculated wrongly from multiplying two 32-bit variables, resulting on a 32-bit number, before casting to 64-bit, so maximum size was 4G. Fixes: 48a399119619 ("hash: replace with cuckoo hash implementation") Signed-off-by: Pablo de Lara --- lib/librte_hash/rte_cuckoo_hash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/librte_hash/rte_cuckoo_hash.c b/lib/librte_hash/rte_cuckoo_hash.c index 4da859a..7019763 100644 --- a/lib/librte_hash/rte_cuckoo_hash.c +++ b/lib/librte_hash/rte_cuckoo_hash.c @@ -238,7 +238,7 @@ rte_hash_create(const struct rte_hash_parameters *params) const uint32_t key_entry_size = sizeof(struct rte_hash_key) + params->key_len; /* Store all keys and leave the first entry as a dummy entry for lookup_bulk */ - const uint64_t key_tbl_size = key_entry_size * (params->entries + 1); + const uint64_t key_tbl_size = (uint64_t) key_entry_size * (params->entries + 1); k = rte_zmalloc_socket(NULL, key_tbl_size, RTE_CACHE_LINE_SIZE, params->socket_id); -- 2.4.2