[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2] xen: address violations of MISRA C:2012 Rule 11.8.
- To: Jan Beulich <jbeulich@xxxxxxxx>, Julien Grall <julien@xxxxxxx>
- From: Simone Ballarin <simone.ballarin@xxxxxxxxxxx>
- Date: Fri, 1 Dec 2023 14:44:55 +0100
- Cc: consulting@xxxxxxxxxxx, maria.celeste.cesario@xxxxxxxxxxx, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
- Delivery-date: Fri, 01 Dec 2023 13:45:01 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 01/12/23 14:03, Jan Beulich wrote:
On 01.12.2023 12:48, Julien Grall wrote:
On 01/12/2023 11:37, Simone Ballarin wrote:
--- a/xen/arch/arm/include/asm/regs.h
+++ b/xen/arch/arm/include/asm/regs.h
@@ -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 = (const uintptr_t)guest_cpu_user_regs() - (const
uintptr_t)(r);
NIT: The const should not be necessary here. Am I correct?
--- a/xen/arch/x86/include/asm/regs.h
+++ b/xen/arch/x86/include/asm/regs.h
@@ -6,7 +6,8 @@
#define guest_mode(r) \
({
\
- unsigned long diff = (char *)guest_cpu_user_regs() - (char *)(r); \
+ unsigned long diff = (const uintptr_t)guest_cpu_user_regs() - \
+ (const uintptr_t(r)); \
Was this compiled on x86? Shouldn't the last one be (const uintptr_t)(r))?
And again with the stray const-s dropped and with indentation adjusted.
I will remove the const in the first parameter and fix the indentation
in the following way:
unsigned long diff = (uintptr_t)guest_cpu_user_regs() - \
(const uintptr_t)(r); \
Jan
--
Simone Ballarin, M.Sc.
Field Application Engineer, BUGSENG (https://bugseng.com)
|