]> xenbits.xensource.com Git - xen.git/commitdiff
arm: fix build with gcc 7
authorJan Beulich <jbeulich@suse.com>
Fri, 19 May 2017 08:12:08 +0000 (10:12 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 19 May 2017 08:12:08 +0000 (10:12 +0200)
The compiler dislikes duplicate "const", and the ones it complains
about look like they we in fact meant to be placed differently.

Also fix array_access_okay() (just like on x86), despite the construct
being unused on ARM: -Wint-in-bool-context, enabled by default in
gcc 7, doesn't like multiplication in conditional operators. "Hide" it,
at the risk of the next compiler version becoming smarter and
recognizing even that. (The hope is that added smartness then would
also better deal with legitimate cases like the one here.) The change
could have been done in access_ok(), but I think we better keep it at
the place the compiler is actually unhappy about.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Julien Grall <julien.grall@arm.com>
Release-acked-by: Julien Grall <julien.grall@arm.com>
xen/arch/arm/platforms/brcm.c
xen/arch/arm/platforms/rcar2.c
xen/include/asm-arm/guest_access.h

index 6d8b5b91757b790b8f12881346f4e69bff78ab1b..d481b2c60f881d4eb905e0ad753bb004f801036d 100644 (file)
@@ -271,7 +271,7 @@ static __init int brcm_init(void)
     return brcm_populate_plat_regs();
 }
 
-static const char const *brcm_dt_compat[] __initconst =
+static const char *const brcm_dt_compat[] __initconst =
 {
     "brcm,bcm7445d0",
     NULL
index bb25751109354b4b5e3d383c37c064df79580f88..df0ac847097449fd82783c1cadf0a16bca78167d 100644 (file)
@@ -46,7 +46,7 @@ static int __init rcar2_smp_init(void)
     return 0;
 }
 
-static const char const *rcar2_dt_compat[] __initdata =
+static const char *const rcar2_dt_compat[] __initconst =
 {
     "renesas,lager",
     NULL
index 5876988b232e1ee43138a640da3526ad6faec3a9..421bca5f36a3e3c1b9cb29f3ab3c51cafbd9196e 100644 (file)
@@ -8,7 +8,8 @@
 #define access_ok(addr,size) (1)
 
 #define array_access_ok(addr,count,size) \
-    (likely(count < (~0UL/size)) && access_ok(addr,count*size))
+    (likely((count) < (~0UL / (size))) && \
+     access_ok(addr, 0 + (count) * (size)))
 
 unsigned long raw_copy_to_guest(void *to, const void *from, unsigned len);
 unsigned long raw_copy_to_guest_flush_dcache(void *to, const void *from,