Skip to content

Commit

Permalink
malloc: fix memory element size in case of padding
Browse files Browse the repository at this point in the history
[ upstream commit 2808a12 ]

This patch fixes wrong inner memory element size when joining two
elements.

Fixes: af75078 ("first public release")

Signed-off-by: Xueming Li <xuemingl@mellanox.com>
Reviewed-by: Anatoly Burakov <anatoly.burakov@intel.com>
  • Loading branch information
Xueming Li authored and kevintraynor committed Dec 11, 2019
1 parent 32a21ec commit 9fd6294
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/librte_eal/common/malloc_elem.c
Expand Up @@ -468,6 +468,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 *
Expand Down

0 comments on commit 9fd6294

Please sign in to comment.