From 2808a12cc05375e986ee1c9bb956bad8288c2b5a Mon Sep 17 00:00:00 2001 From: Xueming Li Date: Thu, 21 Nov 2019 14:25:02 +0000 Subject: [PATCH] malloc: fix memory element size in case of padding This patch fixes wrong inner memory element size when joining two elements. Fixes: af75078fece3 ("first public release") Cc: stable@dpdk.org Signed-off-by: Xueming Li Reviewed-by: Anatoly Burakov --- lib/librte_eal/common/malloc_elem.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/librte_eal/common/malloc_elem.c b/lib/librte_eal/common/malloc_elem.c index afacb1813c..885d00424b 100644 --- a/lib/librte_eal/common/malloc_elem.c +++ b/lib/librte_eal/common/malloc_elem.c @@ -487,6 +487,10 @@ join_elem(struct malloc_elem *elem1, struct malloc_elem *elem2) else elem1->heap->last = elem1; elem1->next = next; + if (elem1->pad) { + struct malloc_elem *inner = RTE_PTR_ADD(elem1, elem1->pad); + inner->size = elem1->size - elem1->pad; + } } struct malloc_elem * -- 2.20.1