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

[Xen-changelog] [xen master] tools/xen-mfndump: Avoid using -ERROR as an upper loop bound



commit f55f10a27c2df554fed42579ef7b374aab5ff262
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Mon Nov 25 11:05:51 2013 +0000
Commit:     Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
CommitDate: Mon Nov 25 12:16:11 2013 +0000

    tools/xen-mfndump: Avoid using -ERROR as an upper loop bound
    
    Coverity ID: 1090375
    
    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, 8 insertions(+), 1 deletions(-)

diff --git a/tools/misc/xen-mfndump.c b/tools/misc/xen-mfndump.c
index 88cfafa..dea9fa9 100644
--- a/tools/misc/xen-mfndump.c
+++ b/tools/misc/xen-mfndump.c
@@ -30,7 +30,8 @@ int help_func(int argc, char *argv[])
 
 int dump_m2p_func(int argc, char *argv[])
 {
-    unsigned long i, max_mfn;
+    unsigned long i;
+    long max_mfn;
     xen_pfn_t *m2p_table;
 
     if ( argc > 0 )
@@ -41,6 +42,12 @@ int dump_m2p_func(int argc, char *argv[])
 
     /* Map M2P and obtain gpfn */
     max_mfn = xc_maximum_ram_page(xch);
+    if ( max_mfn < 0 )
+    {
+        ERROR("Failed to get the maximum mfn");
+        return -1;
+    }
+
     if ( !(m2p_table = xc_map_m2p(xch, max_mfn, PROT_READ, NULL)) )
     {
         ERROR("Failed to map live M2P table");
--
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®.