[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen master] tools/xen-mfndump: Avoid munmap(NULL, PAGE_SIZE) on certain error paths



commit 4fa0ddeef7cf160d7064c8ab361518d1f16fb2e7
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Mon Nov 25 11:05:50 2013 +0000
Commit:     Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
CommitDate: Mon Nov 25 12:15:55 2013 +0000

    tools/xen-mfndump: Avoid munmap(NULL, PAGE_SIZE) on certain error paths
    
    Coverity ID 1090361 1090362 1090363
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    CC: Ian Campbell <Ian.Campbell@xxxxxxxxxx>
    Acked-by: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
---
 tools/misc/xen-mfndump.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/tools/misc/xen-mfndump.c b/tools/misc/xen-mfndump.c
index ce73e5b..88cfafa 100644
--- a/tools/misc/xen-mfndump.c
+++ b/tools/misc/xen-mfndump.c
@@ -240,7 +240,8 @@ int dump_ptes_func(int argc, char *argv[])
            domid, pfn, minfo.p2m_table[pfn]);
 
  out:
-    munmap(page, PAGE_SIZE);
+    if ( page )
+        munmap(page, PAGE_SIZE);
     xc_unmap_domain_meminfo(xch, &minfo);
     munmap(m2p_table, M2P_SIZE(max_mfn));
     return rc;
@@ -359,8 +360,10 @@ int memcmp_mfns_func(int argc, char *argv[])
     printf("  memcpy(1, 2) = %d\n", memcmp(page1, page2, PAGE_SIZE));
 
  out:
-    munmap(page1, PAGE_SIZE);
-    munmap(page2, PAGE_SIZE);
+    if ( page1 )
+        munmap(page1, PAGE_SIZE);
+    if ( page2 )
+        munmap(page2, PAGE_SIZE);
     return rc;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.