]> xenbits.xensource.com Git - qemu-upstream-4.5-testing.git/commitdiff
memory: fix 128 arithmetic in info mtree
authorAlexey Kardashevskiy <aik@ozlabs.ru>
Fri, 30 Aug 2013 08:10:38 +0000 (18:10 +1000)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Tue, 3 Dec 2013 22:05:41 +0000 (16:05 -0600)
mtree_print_mr() calls int128_get64() in 3 places but only 2 places
handle 2^64 correctly.

This fixes the third call of int128_get64().

Cc: qemu-stable@nongnu.org
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit a66670c79c5c7d530d818430ffcdaa25cbf2c2ab)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
memory.c

index 5a10fd0bde229f8d1a7cea5a7158259131cdd16d..7f1f2661a5ee082a519499862d3f38399a51617e 100644 (file)
--- a/memory.c
+++ b/memory.c
@@ -1809,7 +1809,9 @@ static void mtree_print_mr(fprintf_function mon_printf, void *f,
                    mr->alias->name,
                    mr->alias_offset,
                    mr->alias_offset
-                   + (hwaddr)int128_get64(mr->size) - 1);
+                   + (int128_nz(mr->size) ?
+                      (hwaddr)int128_get64(int128_sub(mr->size,
+                                                      int128_one())) : 0));
     } else {
         mon_printf(f,
                    TARGET_FMT_plx "-" TARGET_FMT_plx " (prio %d, %c%c): %s\n",