physmem coverity issues

Change-Id: Ie9ff9b751190632dfc4576e5cbb1987a4142af5e
Signed-off-by: Damjan Marion <damarion@cisco.com>
diff --git a/src/vlib/buffer.c b/src/vlib/buffer.c
index 2f15e65..22cf799 100644
--- a/src/vlib/buffer.c
+++ b/src/vlib/buffer.c
@@ -860,7 +860,7 @@
   vlib_buffer_pool_t *p;
   vlib_physmem_map_t *m = vlib_physmem_get_map (vm, physmem_map_index);
   uword start = pointer_to_uword (m->base);
-  uword size = m->n_pages << m->log2_page_size;
+  uword size = (uword) m->n_pages << m->log2_page_size;
 
   if (bm->buffer_mem_size == 0)
     {
diff --git a/src/vlib/physmem.c b/src/vlib/physmem.c
index e2d8892..2599bce 100755
--- a/src/vlib/physmem.c
+++ b/src/vlib/physmem.c
@@ -39,7 +39,7 @@
   clib_pmalloc_arena_t *a;
   clib_error_t *error = 0;
   void *va;
-  int i;
+  uword i;
 
   va = clib_pmalloc_create_shared_arena (pm, name, size, numa_node);
 
@@ -87,7 +87,7 @@
 
   /* check if pagemap is accessible */
   pt = clib_mem_vm_get_paddr (&pt, min_log2 (sysconf (_SC_PAGESIZE)), 1);
-  if (pt[0])
+  if (pt && pt[0])
     vpm->flags |= VLIB_PHYSMEM_MAIN_F_HAVE_PAGEMAP;
   vec_free (pt);
 
diff --git a/src/vppinfra/pmalloc.c b/src/vppinfra/pmalloc.c
index d354cce..0f9df9c 100644
--- a/src/vppinfra/pmalloc.c
+++ b/src/vppinfra/pmalloc.c
@@ -279,7 +279,7 @@
       goto error;
     }
 
-  memset (va, 0, n_pages << pm->log2_page_sz);
+  clib_memset (va, 0, n_pages << pm->log2_page_sz);
   sys_page_size = sysconf (_SC_PAGESIZE);
   pagemap_fd = open ((char *) "/proc/self/pagemap", O_RDONLY);
 
@@ -324,7 +324,8 @@
 {
   clib_pmalloc_arena_t *a;
   clib_pmalloc_page_t *pp;
-  u32 n_pages = round_pow2 (size, 1 << pm->log2_page_sz) >> pm->log2_page_sz;
+  u32 n_pages = round_pow2 (size, 1ULL << pm->log2_page_sz) >>
+    pm->log2_page_sz;
 
   if (n_pages + vec_len (pm->pages) > pm->max_pages)
     return 0;