]> xenbits.xensource.com Git - people/iwj/xen.git/commitdiff
x86: fix build with gcc 7
authorJan Beulich <jbeulich@suse.com>
Fri, 9 Jun 2017 11:40:28 +0000 (13:40 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 9 Jun 2017 11:40:28 +0000 (13:40 +0200)
-Wint-in-bool-context, enabled by default in gcc 7, doesn't like
multiplication in conditional operators. "Hide" them, at the risk of
the next compiler version becoming smarter and recognizing even those.
(The hope is that added smartness then would also better deal with
legitimate cases like the ones here.)

The change could have been done in access_ok(), but I think we better
keep it at the places the compiler is actually unhappy about.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
master commit: f32400e90c046a9fd76c8917a60d34ade9c02ea2
master date: 2017-05-19 10:11:36 +0200

xen/arch/x86/traps.c
xen/include/asm-x86/x86_64/uaccess.h

index b4642118287363d89c051d02a78c264a4605314a..19ac65265893686b83c8f4c6a6337ba7d44bd398 100644 (file)
@@ -3565,7 +3565,7 @@ static void emulate_gate_op(struct cpu_user_regs *regs)
                 return;
             }
             stkp = (unsigned int *)(unsigned long)((unsigned int)base + esp);
-            if ( !compat_access_ok(stkp - 4 - nparm, (4 + nparm) * 4) )
+            if ( !compat_access_ok(stkp - 4 - nparm, 16 + nparm * 4) )
             {
                 do_guest_trap(TRAP_gp_fault, regs);
                 return;
@@ -3584,7 +3584,7 @@ static void emulate_gate_op(struct cpu_user_regs *regs)
                      !check_stack_limit(ar, limit, esp + nparm * 4, nparm * 4) )
                     return do_guest_trap(TRAP_gp_fault, regs);
                 ustkp = (unsigned int *)(unsigned long)((unsigned int)base + regs->_esp + nparm * 4);
-                if ( !compat_access_ok(ustkp - nparm, nparm * 4) )
+                if ( !compat_access_ok(ustkp - nparm, 0 + nparm * 4) )
                 {
                     do_guest_trap(TRAP_gp_fault, regs);
                     return;
index 4275e66f401f587848268023bd5732f77232de4a..d7dad4f8bce595790f10cd1f269f23ca56108033 100644 (file)
@@ -55,7 +55,7 @@ extern void *xlat_malloc(unsigned long *xlat_page_current, size_t size);
 
 #define compat_array_access_ok(addr,count,size) \
     (likely((count) < (~0U / (size))) && \
-     compat_access_ok(addr, (count) * (size)))
+     compat_access_ok(addr, 0 + (count) * (size)))
 
 #define __put_user_size(x,ptr,size,retval,errret)                      \
 do {                                                                   \