patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Xueming Li <xuemingl@mellanox.com>
To: Anatoly Burakov <anatoly.burakov@intel.com>
Cc: Asaf Penso <asafp@mellanox.com>, dev@dpdk.org, stable@dpdk.org
Subject: [dpdk-stable] [PATCH 2/2] malloc: fix realloc padded element size
Date: Tue, 12 Nov 2019 14:50:28 +0000
Message-ID: <1573570228-15676-2-git-send-email-xuemingl@mellanox.com> (raw)
In-Reply-To: <1573570228-15676-1-git-send-email-xuemingl@mellanox.com>

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 <xuemingl@mellanox.com>
---
 lib/librte_eal/common/malloc_elem.c | 5 +++++
 1 file changed, 5 insertions(+)

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;
+	}
 }
 
 /*
-- 
2.17.1


  reply	other threads:[~2019-11-12 14:50 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-12 14:50 [dpdk-stable] [PATCH 1/2] malloc: fix realloc wrong copy size Xueming Li
2019-11-12 14:50 ` Xueming Li [this message]
2019-11-14 15:11   ` [dpdk-stable] [PATCH 2/2] malloc: fix realloc padded element size Burakov, Anatoly
2019-11-19 20:47   ` David Marchand
2019-11-20  2:12     ` Xueming(Steven) Li
2019-11-20 13:25       ` David Marchand
2019-11-21 12:30         ` Burakov, Anatoly
2019-11-21 12:55           ` Xueming(Steven) Li
2019-11-21 13:15             ` Burakov, Anatoly
2019-11-21 13:17               ` [dpdk-stable] [dpdk-dev] " Burakov, Anatoly
2019-11-21 14:11                 ` Xueming(Steven) Li
2019-11-14 15:11 ` [dpdk-stable] [PATCH 1/2] malloc: fix realloc wrong copy size Burakov, Anatoly

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1573570228-15676-2-git-send-email-xuemingl@mellanox.com \
    --to=xuemingl@mellanox.com \
    --cc=anatoly.burakov@intel.com \
    --cc=asafp@mellanox.com \
    --cc=dev@dpdk.org \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

patches for DPDK stable branches

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/stable/0 stable/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 stable stable/ https://inbox.dpdk.org/stable \
		stable@dpdk.org
	public-inbox-index stable

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.stable


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git