mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
libxc: fix out of range shift in populate_acpi_pages
unsigned int is only 4-byte long and "4" is treated as int. The shift would overflow. Use unsigned long type, calculate the bits to shift before shifting instead of shifting twice. Caught by clang compilation test. Signed-off-by: Wei Liu <wei.liu2@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
This commit is contained in:
1 parent
9ef164f8b9
commit
d7c34a18a9
1 file changed
+1
-1
@@ -1048,7 +1048,7 @@ static int populate_acpi_pages(struct xc_dom_image *dom,
|
||||
xc_interface *xch = dom->xch;
|
||||
uint32_t domid = dom->guest_domid;
|
||||
unsigned long idx;
|
||||
unsigned int first_high_idx = (4 << 30) >> PAGE_SHIFT; /* 4GB */
|
||||
unsigned long first_high_idx = 4UL << (30 - PAGE_SHIFT); /* 4GB */
|
||||
|
||||
for ( ; num_pages; num_pages--, extents++ )
|
||||
{
|
||||
|
||||