[PATCH 1/2] hash: fix maybe-uninitialized warning on minsize build

Cheryl Bansal cheryl.bansal at altera.com
Mon Nov 23 07:13:18 CET 2026


With --buildtype=minsize and -Werror, gcc reports that slot_id may be
used uninitialized in alloc_slot(). This is a false positive: every
path either returns EMPTY_SLOT or assigns slot_id before use.

Initialize slot_id to EMPTY_SLOT to silence the warning.

Fixes: 5915699153d7 ("hash: fix scaling by reducing contention")
Cc: stable at dpdk.org

Signed-off-by: Cheryl Bansal <cheryl.bansal at altera.com>
---
 .mailmap                   | 1 +
 lib/hash/rte_cuckoo_hash.c | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/.mailmap b/.mailmap
index a0096fb97a..5146a4fa2b 100644
--- a/.mailmap
+++ b/.mailmap
@@ -288,6 +288,7 @@ Chenna Arnoori <chenna.arnoori at broadcom.com>
 Chenxingyu Wang <wangchenxingyu at huawei.com>
 Chenxu Di <chenxux.di at intel.com>
 Chenyu Huang <chenyux.huang at intel.com>
+Cheryl Bansal <cheryl.bansal at altera.com>
 Cheryl Houser <chouser at vmware.com>
 Chinh Cao <chinh.t.cao at intel.com>
 Chintu Hetam <rometoroam at gmail.com>
diff --git a/lib/hash/rte_cuckoo_hash.c b/lib/hash/rte_cuckoo_hash.c
index 5d495ae973..47ea909d38 100644
--- a/lib/hash/rte_cuckoo_hash.c
+++ b/lib/hash/rte_cuckoo_hash.c
@@ -1298,7 +1298,7 @@ static inline uint32_t
 alloc_slot(const struct rte_hash *h, struct lcore_cache *cached_free_slots)
 {
 	unsigned int n_slots;
-	uint32_t slot_id;
+	uint32_t slot_id = EMPTY_SLOT;
 
 	if (h->use_local_cache) {
 		/* Try to get a free slot from the local cache */
-- 
2.43.0



More information about the dev mailing list