From: Jan Beulich <jbeulich@suse.com>
To: Simone Ballarin <simone.ballarin@bugseng.com>
Cc: consulting@bugseng.com, maria.celeste.cesario@bugseng.com,
"Stefano Stabellini" <sstabellini@kernel.org>,
"Julien Grall" <julien@xen.org>,
"Bertrand Marquis" <bertrand.marquis@arm.com>,
"Michal Orzel" <michal.orzel@amd.com>,
"Volodymyr Babchuk" <Volodymyr_Babchuk@epam.com>,
"Andrew Cooper" <andrew.cooper3@citrix.com>,
"Roger Pau Monné" <roger.pau@citrix.com>, "Wei Liu" <wl@xen.org>,
xen-devel@lists.xenproject.org
Subject: Re: [PATCH v3] xen: address violations of MISRA C:2012 Rule 11.8.
Date: Mon, 4 Dec 2023 17:54:24 +0100 [thread overview]
Message-ID: <3c7abc30-20d7-4a4e-b963-27339952e7a3@suse.com> (raw)
In-Reply-To: <de2bfb322d91e99cf794c233461a04e638ee93aa.1701707356.git.maria.celeste.cesario@bugseng.com>
On 04.12.2023 17:32, Simone Ballarin wrote:
> From: Maria Celeste Cesario <maria.celeste.cesario@bugseng.com>
>
> 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>
I consider it good practice to at least briefly say what the rule is
about, so it is clear why certain changes need doing.
> --- a/xen/arch/arm/include/asm/atomic.h
> +++ b/xen/arch/arm/include/asm/atomic.h
> @@ -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;
> }
What about PPC's identical code?
> --- a/xen/arch/x86/include/asm/regs.h
> +++ b/xen/arch/x86/include/asm/regs.h
> @@ -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. */ \
This part
Acked-by: Jan Beulich <jbeulich@suse.com>
Jan
next prev parent reply other threads:[~2023-12-04 16:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-04 16:32 [PATCH v3] xen: address violations of MISRA C:2012 Rule 11.8 Simone Ballarin
2023-12-04 16:54 ` Jan Beulich [this message]
2023-12-04 17:12 ` Simone Ballarin
2023-12-04 17:28 ` Julien Grall
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3c7abc30-20d7-4a4e-b963-27339952e7a3@suse.com \
--to=jbeulich@suse.com \
--cc=Volodymyr_Babchuk@epam.com \
--cc=andrew.cooper3@citrix.com \
--cc=bertrand.marquis@arm.com \
--cc=consulting@bugseng.com \
--cc=julien@xen.org \
--cc=maria.celeste.cesario@bugseng.com \
--cc=michal.orzel@amd.com \
--cc=roger.pau@citrix.com \
--cc=simone.ballarin@bugseng.com \
--cc=sstabellini@kernel.org \
--cc=wl@xen.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.