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

[Xen-changelog] [xen-unstable] [LIBXC] Fix iteration over GDT in save/restore code.



# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1166609193 0
# Node ID 1818b322ede953f4fcca2d3d1239ce5111a811c5
# Parent  f80f1cc7f85e10ae163e1536637517e026f45358
[LIBXC] Fix iteration over GDT in save/restore code.
Bug spotted by Tim Wood.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 tools/libxc/xc_linux_restore.c |    2 +-
 tools/libxc/xc_linux_save.c    |   17 ++++++-----------
 2 files changed, 7 insertions(+), 12 deletions(-)

diff -r f80f1cc7f85e -r 1818b322ede9 tools/libxc/xc_linux_restore.c
--- a/tools/libxc/xc_linux_restore.c    Wed Dec 20 09:48:21 2006 +0000
+++ b/tools/libxc/xc_linux_restore.c    Wed Dec 20 10:06:33 2006 +0000
@@ -709,7 +709,7 @@ int xc_linux_restore(int xc_handle, int 
         goto out;
     }
 
-    for (i = 0; i < ctxt.gdt_ents; i += 512) {
+    for (i = 0; (512*i) < ctxt.gdt_ents; i++) {
         pfn = ctxt.gdt_frames[i];
         if ((pfn >= max_pfn) || (pfn_type[pfn] != XEN_DOMCTL_PFINFO_NOTAB)) {
             ERROR("GDT frame number is bad");
diff -r f80f1cc7f85e -r 1818b322ede9 tools/libxc/xc_linux_save.c
--- a/tools/libxc/xc_linux_save.c       Wed Dec 20 09:48:21 2006 +0000
+++ b/tools/libxc/xc_linux_save.c       Wed Dec 20 10:06:33 2006 +0000
@@ -1052,7 +1052,7 @@ int xc_linux_save(int xc_handle, int io_
             DPRINTF("(of which %ld were fixups)\n", needed_to_fix  );
         }
 
-        if (last_iter && debug){
+        if (last_iter && debug) {
             int minusone = -1;
             memset(to_send, 0xff, BITMAP_SIZE);
             debug = 0;
@@ -1068,17 +1068,14 @@ int xc_linux_save(int xc_handle, int io_
             continue;
         }
 
-        if (last_iter) break;
+        if (last_iter)
+            break;
 
         if (live) {
-
-
-            if(
-                ((sent_this_iter > sent_last_iter) && RATE_IS_MAX()) ||
+            if (((sent_this_iter > sent_last_iter) && RATE_IS_MAX()) ||
                 (iter >= max_iters) ||
                 (sent_this_iter+skip_this_iter < 50) ||
-                (total_sent > max_pfn*max_factor) ) {
-
+                (total_sent > max_pfn*max_factor)) {
                 DPRINTF("Start last iteration\n");
                 last_iter = 1;
 
@@ -1106,8 +1103,6 @@ int xc_linux_save(int xc_handle, int io_
             print_stats(xc_handle, dom, sent_this_iter, &stats, 1);
 
         }
-
-
     } /* end of while 1 */
 
     DPRINTF("All memory is saved\n");
@@ -1159,7 +1154,7 @@ int xc_linux_save(int xc_handle, int io_
     }
 
     /* Canonicalise each GDT frame number. */
-    for ( i = 0; i < ctxt.gdt_ents; i += 512 ) {
+    for ( i = 0; (512*i) < ctxt.gdt_ents; i++ ) {
         if ( !translate_mfn_to_pfn(&ctxt.gdt_frames[i]) ) {
             ERROR("GDT frame is not in range of pseudophys map");
             goto out;

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
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®.