]> xenbits.xensource.com Git - people/royger/xen.git/commitdiff
xen: address violations of MISRA C:2012 Rule 11.8
authorMaria Celeste Cesario <maria.celeste.cesario@bugseng.com>
Tue, 5 Dec 2023 08:58:37 +0000 (09:58 +0100)
committerJan Beulich <jbeulich@suse.com>
Tue, 5 Dec 2023 08:58:37 +0000 (09:58 +0100)
Remove or amend casts to comply with Rule 11.8.

Fix violations by adding missing const qualifier in cast.
Fix violations by removing unnecessary cast.
Change type of operands from char* to uintptr_t: uintptr_t is
the appropriate type for memory address operations.

No functional changes.

Signed-off-by: Maria Celeste Cesario <maria.celeste.cesario@bugseng.com>
Signed-off-by: Simone Ballarin <simone.ballarin@bugseng.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Julien Grall <jgrall@amazon.com>
xen/arch/arm/dom0less-build.c
xen/arch/arm/include/asm/atomic.h
xen/arch/arm/include/asm/regs.h
xen/arch/x86/include/asm/regs.h

index d39cbd969acac91116c425dd6cc735b8d30b5436..fb63ec6fd11110d1f3847fcec37121268e147994 100644 (file)
@@ -354,7 +354,7 @@ static int __init handle_passthrough_prop(struct kernel_info *kinfo,
     if ( node == NULL )
     {
         printk(XENLOG_ERR "Couldn't find node %s in host_dt!\n",
-               (char *)xen_path->data);
+               xen_path->data);
         return -EINVAL;
     }
 
index 64314d59b3b0d841408dec07df51340ad4bbee24..517216d2a8461df4a14694a92f7371f62b831c8e 100644 (file)
@@ -154,7 +154,7 @@ static always_inline void write_atomic_size(volatile void *p,
  */
 static inline int atomic_read(const atomic_t *v)
 {
-    return *(volatile int *)&v->counter;
+    return *(const volatile int *)&v->counter;
 }
 
 static inline int _atomic_read(atomic_t v)
index 8a0db95415077f5680d819f2f119c1a38d19bfe6..f998aedff5bc19377e3ba3232e3cd2a4a9d6a76f 100644 (file)
@@ -48,7 +48,7 @@ static inline bool regs_mode_is_32bit(const struct cpu_user_regs *regs)
 
 static inline bool guest_mode(const struct cpu_user_regs *r)
 {
-    unsigned long diff = (char *)guest_cpu_user_regs() - (char *)(r);
+    unsigned long diff = (uintptr_t)guest_cpu_user_regs() - (uintptr_t)(r);
     /* Frame pointer must point into current CPU stack. */
     ASSERT(diff < STACK_SIZE);
     /* If not a guest frame, it must be a hypervisor frame. */
index 3fb94deedc7b9bc7ff3c88b28a450e9e7fbe3654..ddf5e14e5719e8501c8f447cfea2786991f0e1f2 100644 (file)
@@ -6,7 +6,7 @@
 
 #define guest_mode(r)                                                         \
 ({                                                                            \
-    unsigned long diff = (char *)guest_cpu_user_regs() - (char *)(r);         \
+    unsigned long diff = (uintptr_t)guest_cpu_user_regs() - (uintptr_t)(r);   \
     /* Frame pointer must point into current CPU stack. */                    \
     ASSERT(diff < STACK_SIZE);                                                \
     /* If not a guest frame, it must be a hypervisor frame. */                \