xen: address violations of MISRA C:2012 Rule 11.8

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>
This commit is contained in:
Maria Celeste Cesario authored and Jan Beulich committed 2023-12-05 09:58:37 +01:00
1 parent 3e7a3f08ce
commit 6f7db3e0a0
4 files changed
+4 -4

No files matched your search

+1 -1
View 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;
}
+1 -1
View 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)
+1 -1
View 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. */
+1 -1
View 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. */ \
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.