|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] libxc: fix out of range shift in populate_acpi_pages
commit d7c34a18a9fd6c6dccf99eeeeaf14ff352bc4c0d
Author: Wei Liu <wei.liu2@xxxxxxxxxx>
AuthorDate: Wed Sep 28 16:38:19 2016 +0100
Commit: Wei Liu <wei.liu2@xxxxxxxxxx>
CommitDate: Wed Sep 28 16:51:50 2016 +0100
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@xxxxxxxxxx>
Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
tools/libxc/xc_dom_core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/libxc/xc_dom_core.c b/tools/libxc/xc_dom_core.c
index 87b450c..5884cdb 100644
--- a/tools/libxc/xc_dom_core.c
+++ b/tools/libxc/xc_dom_core.c
@@ -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++ )
{
--
generated by git-patchbot for /home/xen/git/xen.git#master
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |