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

[Xen-devel] [PATCH] x86/badpage: Fix badpage->order overflow



For order 32 or more, the shift will truncate.  Spotted by Coverity.

Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
CC: Jan Beulich <JBeulich@xxxxxxxx>
CC: Wei Liu <wei.liu2@xxxxxxxxxx>
---
 xen/common/page_alloc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 1aec13e..88d1637 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -334,7 +334,7 @@ void __init init_boot_pages(paddr_t ps, paddr_t pe)
         for ( i = 0; i < array_size; i++ )
         {
             bootmem_region_zap(badpage->mfn,
-                               badpage->mfn + (1U << badpage->order));
+                               badpage->mfn + (1UL << badpage->order));
             badpage++;
         }
     }
@@ -347,7 +347,7 @@ void __init init_boot_pages(paddr_t ps, paddr_t pe)
             for ( i = 0; i < array_size; i++ )
             {
                 bootmem_region_zap(badpage->mfn,
-                                   badpage->mfn + (1U << badpage->order));
+                                   badpage->mfn + (1UL << badpage->order));
                 badpage++;
             }
         }
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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