ia64/xen-unstable
changeset 13128:1818b322ede9
[LIBXC] Fix iteration over GDT in save/restore code.
Bug spotted by Tim Wood.
Signed-off-by: Keir Fraser <keir@xensource.com>
Bug spotted by Tim Wood.
Signed-off-by: Keir Fraser <keir@xensource.com>
author | kfraser@localhost.localdomain |
---|---|
date | Wed Dec 20 10:06:33 2006 +0000 (2006-12-20) |
parents | f80f1cc7f85e |
children | f99dd72ae205 |
files | tools/libxc/xc_linux_restore.c tools/libxc/xc_linux_save.c |
line diff
1.1 --- a/tools/libxc/xc_linux_restore.c Wed Dec 20 09:48:21 2006 +0000 1.2 +++ b/tools/libxc/xc_linux_restore.c Wed Dec 20 10:06:33 2006 +0000 1.3 @@ -709,7 +709,7 @@ int xc_linux_restore(int xc_handle, int 1.4 goto out; 1.5 } 1.6 1.7 - for (i = 0; i < ctxt.gdt_ents; i += 512) { 1.8 + for (i = 0; (512*i) < ctxt.gdt_ents; i++) { 1.9 pfn = ctxt.gdt_frames[i]; 1.10 if ((pfn >= max_pfn) || (pfn_type[pfn] != XEN_DOMCTL_PFINFO_NOTAB)) { 1.11 ERROR("GDT frame number is bad");
2.1 --- a/tools/libxc/xc_linux_save.c Wed Dec 20 09:48:21 2006 +0000 2.2 +++ b/tools/libxc/xc_linux_save.c Wed Dec 20 10:06:33 2006 +0000 2.3 @@ -1052,7 +1052,7 @@ int xc_linux_save(int xc_handle, int io_ 2.4 DPRINTF("(of which %ld were fixups)\n", needed_to_fix ); 2.5 } 2.6 2.7 - if (last_iter && debug){ 2.8 + if (last_iter && debug) { 2.9 int minusone = -1; 2.10 memset(to_send, 0xff, BITMAP_SIZE); 2.11 debug = 0; 2.12 @@ -1068,17 +1068,14 @@ int xc_linux_save(int xc_handle, int io_ 2.13 continue; 2.14 } 2.15 2.16 - if (last_iter) break; 2.17 + if (last_iter) 2.18 + break; 2.19 2.20 if (live) { 2.21 - 2.22 - 2.23 - if( 2.24 - ((sent_this_iter > sent_last_iter) && RATE_IS_MAX()) || 2.25 + if (((sent_this_iter > sent_last_iter) && RATE_IS_MAX()) || 2.26 (iter >= max_iters) || 2.27 (sent_this_iter+skip_this_iter < 50) || 2.28 - (total_sent > max_pfn*max_factor) ) { 2.29 - 2.30 + (total_sent > max_pfn*max_factor)) { 2.31 DPRINTF("Start last iteration\n"); 2.32 last_iter = 1; 2.33 2.34 @@ -1106,8 +1103,6 @@ int xc_linux_save(int xc_handle, int io_ 2.35 print_stats(xc_handle, dom, sent_this_iter, &stats, 1); 2.36 2.37 } 2.38 - 2.39 - 2.40 } /* end of while 1 */ 2.41 2.42 DPRINTF("All memory is saved\n"); 2.43 @@ -1159,7 +1154,7 @@ int xc_linux_save(int xc_handle, int io_ 2.44 } 2.45 2.46 /* Canonicalise each GDT frame number. */ 2.47 - for ( i = 0; i < ctxt.gdt_ents; i += 512 ) { 2.48 + for ( i = 0; (512*i) < ctxt.gdt_ents; i++ ) { 2.49 if ( !translate_mfn_to_pfn(&ctxt.gdt_frames[i]) ) { 2.50 ERROR("GDT frame is not in range of pseudophys map"); 2.51 goto out;