From: Xueming Li Date: Tue, 12 Nov 2019 14:50:28 +0000 (+0000) Subject: malloc: fix realloc padded element size X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=90f538b8630b2782460aae46f346ddb4fc102011;p=dpdk.git malloc: fix realloc padded element size When resize a memory with next element, the original element size grows. If the orginal element has padding, the real inner element size didn't grow as well and this causes trailer verification failure when malloc debug enabled. Fixes: af75078fece3 ("first public release") Cc: stable@dpdk.org Signed-off-by: Xueming Li Reviewed-by: Anatoly Burakov --- diff --git a/lib/librte_eal/common/malloc_elem.c b/lib/librte_eal/common/malloc_elem.c index 658c9b5b79..afacb1813c 100644 --- a/lib/librte_eal/common/malloc_elem.c +++ b/lib/librte_eal/common/malloc_elem.c @@ -307,6 +307,11 @@ split_elem(struct malloc_elem *elem, struct malloc_elem *split_pt) elem->next = split_pt; elem->size = old_elem_size; set_trailer(elem); + if (elem->pad) { + /* Update inner padding inner element size. */ + elem = RTE_PTR_ADD(elem, elem->pad); + elem->size = old_elem_size - elem->pad; + } } /*