aboutsummaryrefslogtreecommitdiffstats
path: root/src/vppinfra
diff options
context:
space:
mode:
authorKingwel Xie <kingwel.xie@ericsson.com>2018-11-11 22:55:58 -0500
committerDamjan Marion <dmarion@me.com>2018-11-27 17:58:41 +0000
commitdbc34b89061feae88e0641eab4c82e48903b8396 (patch)
tree508ba53d1a70b0e70ac1e0e1a7bb5ea9eb4a05ad /src/vppinfra
parentad4426e565e4066a9af4ac8058a0efb6cf29db42 (diff)
pmalloc: correct format_pmalloc_map u32 index overrun bug
Change-Id: I95ba4eab6e2154ef33a479450b997c8317db3a92 Signed-off-by: Kingwel Xie <kingwel.xie@ericsson.com>
Diffstat (limited to 'src/vppinfra')
-rw-r--r--src/vppinfra/pmalloc.c7
-rw-r--r--src/vppinfra/pmalloc.h1
2 files changed, 3 insertions, 5 deletions
diff --git a/src/vppinfra/pmalloc.c b/src/vppinfra/pmalloc.c
index b707336bfbd..e903511ab81 100644
--- a/src/vppinfra/pmalloc.c
+++ b/src/vppinfra/pmalloc.c
@@ -359,7 +359,6 @@ pmalloc_map_pages (clib_pmalloc_main_t * pm, clib_pmalloc_arena_t * a,
pp->n_free_blocks = 1 << (pm->def_log2_page_sz - PMALLOC_LOG2_BLOCK_SZ);
pp->index = pp - pm->pages;
pp->arena_index = a->index;
- pp->pa = (uword) va + (1 << pm->def_log2_page_sz) * i;
vec_add1 (a->page_indices, pp->index);
a->n_pages++;
}
@@ -608,8 +607,6 @@ format_pmalloc_page (u8 * s, va_list * va)
int verbose = va_arg (*va, int);
u32 indent = format_get_indent (s);
- s = format (s, "page %u: phys-addr %p ", pp->index, pp->pa);
-
if (pp->chunks == 0)
return s;
@@ -699,7 +696,9 @@ format_pmalloc_map (u8 * s, va_list * va)
{
uword *lookup_val, pa, va;
lookup_val = vec_elt_at_index (pm->lookup_table, index);
- va = pointer_to_uword (pm->base) + (index << pm->lookup_log2_page_sz);
+ va =
+ pointer_to_uword (pm->base) +
+ ((uword) index << pm->lookup_log2_page_sz);
pa = va - *lookup_val;
s =
format (s, "\n %16p %13p %8U", uword_to_pointer (va, u64),
diff --git a/src/vppinfra/pmalloc.h b/src/vppinfra/pmalloc.h
index eae317fb945..25c46783f8c 100644
--- a/src/vppinfra/pmalloc.h
+++ b/src/vppinfra/pmalloc.h
@@ -36,7 +36,6 @@ typedef struct
{
u32 index;
u32 arena_index;
- uword pa;
clib_pmalloc_chunk_t *chunks;
u32 first_chunk_index;
u32 n_free_chunks;