summaryrefslogtreecommitdiffstats
path: root/src/vppinfra/dlmalloc.c
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2020-11-05 14:54:08 +0100
committerFlorin Coras <florin.coras@gmail.com>2020-11-05 20:53:43 +0000
commitdcb1db9eb10ce0ff96008f82e119269dc8f3e209 (patch)
treef6e81e6927c3de97969c9539bd338a5a93753595 /src/vppinfra/dlmalloc.c
parentaf7892c08b2d4984f4c93bb8c7cc07aec36b5055 (diff)
vppinfra: mspace_get_aligned should respect MALLOC_ALIGNMENT
While underlying mspace_malloc() respects MALLOC_ALIGNMENT (16) mspace_get_aligned moves start of data for 4 bytes making final result not aligned to MALLOC_ALIGNED. Type: fix Change-Id: Ib1584f315e3658b3b748ebf4886fb7389ce640fe Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vppinfra/dlmalloc.c')
-rw-r--r--src/vppinfra/dlmalloc.c23
1 files changed, 1 insertions, 22 deletions
diff --git a/src/vppinfra/dlmalloc.c b/src/vppinfra/dlmalloc.c
index 7c4664bf8fd..36c80b09b87 100644
--- a/src/vppinfra/dlmalloc.c
+++ b/src/vppinfra/dlmalloc.c
@@ -4200,28 +4200,7 @@ void* mspace_get_aligned (mspace msp,
* the base of the dlmalloc object
*/
n_user_data_bytes += sizeof(unsigned);
-
- /*
- * Alignment requests less than the size of an mmx vector are ignored
- */
- if (align < sizeof (uword)) {
- rv = mspace_malloc (msp, n_user_data_bytes);
- if (rv == 0)
- return rv;
-
- if (use_trace(ms)) {
- mchunkptr p = mem2chunk(rv);
- size_t psize = chunksize(p);
-
- mheap_get_trace ((unsigned long)rv + sizeof (unsigned), psize);
- }
-
- wwp = (unsigned *)rv;
- *wwp = 0;
- rv += sizeof (unsigned);
-
- return rv;
- }
+ align = align < MALLOC_ALIGNMENT ? MALLOC_ALIGNMENT : align;
/*
* Alignment requests greater than 4K must be at offset zero,