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

[Xen-devel] [PATCH]: hvmloader: Fixed get_memsize() overflow



Hi,

When hvmloader calculate memory via get_memsize(), we have to cast 
hvm_info->high_mem_pgend to uint64_t, or may overflow and made hvm
guest bootup failed.

How to reproduce:
  Set memory size more than 3840M and the value a little less than
  multi 1024M like 4095, 4094, 8024 and so on, boot hvm will failed.


Signed-off-by: Joe Jin <joe.jin@xxxxxxxxxx>
Cc: Keir Fraser <keir.fraser@xxxxxxxxxx>

 smbios.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---

diff -r c0cb307d927f tools/firmware/hvmloader/smbios.c
--- a/tools/firmware/hvmloader/smbios.c Mon Jul 13 12:35:34 2009 +0100
+++ b/tools/firmware/hvmloader/smbios.c Fri Jul 24 10:24:28 2009 +0800
@@ -148,7 +148,7 @@
 
     sz = (uint64_t)hvm_info->low_mem_pgend << PAGE_SHIFT;
     if ( hvm_info->high_mem_pgend )
-        sz += (hvm_info->high_mem_pgend << PAGE_SHIFT) - (1ull << 32);
+        sz += ((uint64_t)hvm_info->high_mem_pgend << PAGE_SHIFT) - (1ull << 
32);
 
     /*
      * Round up to the nearest MB.  The user specifies domU pseudo-physical 



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

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