diff options
author | Damjan Marion <damarion@cisco.com> | 2018-10-26 10:29:35 +0200 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2018-10-28 14:58:45 +0000 |
commit | 878b65aa6c16b6013e75ea9039b9978c52982e97 (patch) | |
tree | 3b0d1412d6e83996741f39cf50bee6699fbbdcff /src/vppinfra/pmalloc.c | |
parent | 5665cedf57165c05d00f28de06b627047902ffce (diff) |
physmem: coverity issues
Change-Id: I34cc55d8292a69fb451ed0031484994f51d3537a
Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vppinfra/pmalloc.c')
-rw-r--r-- | src/vppinfra/pmalloc.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/vppinfra/pmalloc.c b/src/vppinfra/pmalloc.c index 98e3369bbca..a881a65310a 100644 --- a/src/vppinfra/pmalloc.c +++ b/src/vppinfra/pmalloc.c @@ -101,7 +101,7 @@ clib_pmalloc_init (clib_pmalloc_main_t * pm, uword size) pm->base += off; } - munmap (pm->base + (pm->max_pages * pagesize), pagesize - off); + munmap (pm->base + ((uword) pm->max_pages * pagesize), pagesize - off); return 0; } @@ -215,7 +215,7 @@ pmalloc_update_lookup_table (clib_pmalloc_main_t * pm, u32 first, u32 count) p = first * elts_per_page; if (pm->flags & CLIB_PMALLOC_F_NO_PAGEMAP) { - while (p < elts_per_page * count) + while (p < (uword) elts_per_page * count) { pm->lookup_table[p] = pointer_to_uword (pm->base) + (p << pm->lookup_log2_page_sz); @@ -225,9 +225,10 @@ pmalloc_update_lookup_table (clib_pmalloc_main_t * pm, u32 first, u32 count) } fd = open ((char *) "/proc/self/pagemap", O_RDONLY); - while (p < elts_per_page * count) + while (p < (uword) elts_per_page * count) { va = pointer_to_uword (pm->base) + (p << pm->lookup_log2_page_sz); + pa = 0; seek = (va >> pm->sys_log2_page_sz) * sizeof (pa); if (fd != -1 && lseek (fd, seek, SEEK_SET) == seek && read (fd, &pa, sizeof (pa)) == (sizeof (pa)) && |