8151509: In check_addr0() function pointer is not updated correctly
authorcsahu
Mon, 14 Mar 2016 18:05:37 +0530
changeset 37117 27aec253e606
parent 37096 42437cf54027
child 37118 42d3dc23603e
8151509: In check_addr0() function pointer is not updated correctly Reviewed-by: dholmes, ddmitriev, stuefe Contributed-by: cheleswer.sahu@oracle.com
hotspot/src/os/solaris/vm/os_solaris.cpp
--- a/hotspot/src/os/solaris/vm/os_solaris.cpp	Wed Mar 09 17:03:04 2016 +0100
+++ b/hotspot/src/os/solaris/vm/os_solaris.cpp	Mon Mar 14 18:05:37 2016 +0530
@@ -1898,7 +1898,7 @@
   int fd = ::open("/proc/self/map",O_RDONLY);
   if (fd >= 0) {
     prmap_t *p = NULL;
-    char *mbuff = (char *) calloc(read_chunk, sizeof(prmap_t) + 1);
+    char *mbuff = (char *) calloc(read_chunk, sizeof(prmap_t));
     if (NULL == mbuff) {
       ::close(fd);
       return status;
@@ -1912,7 +1912,7 @@
       p = (prmap_t *)mbuff;
       for(int i = 0; i < nmap; i++){
         if (p->pr_vaddr == 0x0) {
-          st->print("Warning: Address: " PTR_FORMAT ", Size: %dK, ",p->pr_vaddr, p->pr_size/1024);
+          st->print("Warning: Address: " PTR_FORMAT ", Size: " SIZE_FORMAT "K, ",p->pr_vaddr, p->pr_size/1024);
           st->print("Mapped file: %s, ", p->pr_mapname[0] == '\0' ? "None" : p->pr_mapname);
           st->print("Access: ");
           st->print("%s",(p->pr_mflags & MA_READ)  ? "r" : "-");
@@ -1921,13 +1921,12 @@
           st->cr();
           status = true;
         }
-        p = (prmap_t *)(mbuff + sizeof(prmap_t));
+        p++;
       }
-      memset(mbuff, 0, read_chunk*sizeof(prmap_t)+1);
     }
     free(mbuff);
-  }
-  ::close(fd);
+    ::close(fd);
+  }
   return status;
 }