[PATCH 1/4] eal: fix list index for 256 byte element

Ruifeng Wang ruifeng.wang at arm.com
Fri May 19 06:29:20 CEST 2023


Elements with 2^8B size should fall into index 1 of the list.

Fixes: f62f4a375ff4 ("malloc: optimize 4K allocations")
Cc: changfengnan at bytedance.com
Cc: stable at dpdk.org

Signed-off-by: Ruifeng Wang <ruifeng.wang at arm.com>
---
 lib/eal/common/malloc_elem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/eal/common/malloc_elem.c b/lib/eal/common/malloc_elem.c
index 35a2313d04..619c040aa3 100644
--- a/lib/eal/common/malloc_elem.c
+++ b/lib/eal/common/malloc_elem.c
@@ -382,7 +382,7 @@ malloc_elem_free_list_index(size_t size)
 	size_t log2;
 	size_t index;
 
-	if (size <= (1UL << MALLOC_MINSIZE_LOG2))
+	if (size < (1UL << MALLOC_MINSIZE_LOG2))
 		return 0;
 
 	/* Find next power of 2 > size. */
-- 
2.25.1



More information about the stable mailing list