From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 293D4A04C3 for ; Thu, 21 Nov 2019 15:25:20 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 03B852BBB; Thu, 21 Nov 2019 15:25:20 +0100 (CET) Received: from git-send-mailer.rdmz.labs.mlnx (unknown [37.142.13.130]) by dpdk.org (Postfix) with ESMTP id DB72C91; Thu, 21 Nov 2019 15:25:16 +0100 (CET) From: Xueming Li To: Anatoly Burakov Cc: Xueming Li , Asaf Penso , dev@dpdk.org, stable@dpdk.org Date: Thu, 21 Nov 2019 14:25:02 +0000 Message-Id: <1574346302-1263-1-git-send-email-xuemingl@mellanox.com> X-Mailer: git-send-email 1.8.3.1 Subject: [dpdk-stable] [PATCH] malloc: fix memory element size in case of padding X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" 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 --- 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.17.1