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

[Xen-devel] [PATCH] xen/x86: Fix compilation issue with clang 3.2



HYPERVISOR_VIRT_START is an unsigned long constant. In shadow code, Xen
compares this value with a int which is wrong.

multi.c:1981:5: error: comparison of constant 8796025913344 with expression of
type 'int' is always true [-Werror,-Wtautological-constant-out-of-range-compare]
    SHADOW_FOREACH_L2E(sl2mfn, sl2e, 0, 0, v->domain, {
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
multi.c:1320:18: note: expanded from macro 'SHADOW_FOREACH_L2E'
                       < (HYPERVISOR_VIRT_START >> SHADOW_L2_PAGETABLE_SHIFT) ) 
\
                       ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Julien Grall <julien.grall@xxxxxxxxxx>
---
 xen/arch/x86/mm/shadow/multi.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c
index a8ef75e..f2e70d2 100644
--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -1308,7 +1308,8 @@ do {                                                      
              \
 /* 32-bit l2 on PAE/64: four pages, touch every second entry, and avoid Xen */
 #define SHADOW_FOREACH_L2E(_sl2mfn, _sl2e, _gl2p, _done, _dom, _code)     \
 do {                                                                      \
-    int _i, _j, __done = 0;                                               \
+    unsigned long _i, _j;                                                 \
+    int __done = 0;                                                       \
     int _xen = !shadow_mode_external(_dom);                               \
     ASSERT(mfn_to_page(_sl2mfn)->u.sh.type == SH_type_l2_32_shadow);\
     for ( _j = 0; _j < 4 && !__done; _j++ )                               \
@@ -1335,7 +1336,7 @@ do {                                                      
                \
 /* PAE: if it's an l2h, don't touch Xen mappings */
 #define SHADOW_FOREACH_L2E(_sl2mfn, _sl2e, _gl2p, _done, _dom, _code)      \
 do {                                                                       \
-    int _i;                                                                \
+    unsigned long _i;                                                      \
     int _xen = !shadow_mode_external(_dom);                                \
     shadow_l2e_t *_sp = sh_map_domain_page((_sl2mfn));                     \
     ASSERT(mfn_to_page(_sl2mfn)->u.sh.type == SH_type_l2_pae_shadow \
-- 
1.7.10.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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