All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simone Ballarin <simone.ballarin@bugseng.com>
To: Jan Beulich <jbeulich@suse.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 18:12:44 +0100	[thread overview]
Message-ID: <deaf5661-b4ed-432f-940f-11ff44681f2f@bugseng.com> (raw)
In-Reply-To: <3c7abc30-20d7-4a4e-b963-27339952e7a3@suse.com>

On 04/12/23 17:54, Jan Beulich wrote:
> 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?

If the ARM part is accepted, I will include this change in an upcoming 
series for Rule 11.8 (which I'm working on), otherwise in v4.

> 
>> --- 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

-- 
Simone Ballarin, M.Sc.

Field Application Engineer, BUGSENG (https://bugseng.com)



  reply	other threads:[~2023-12-04 17:13 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
2023-12-04 17:12   ` Simone Ballarin [this message]
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=deaf5661-b4ed-432f-940f-11ff44681f2f@bugseng.com \
    --to=simone.ballarin@bugseng.com \
    --cc=Volodymyr_Babchuk@epam.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=bertrand.marquis@arm.com \
    --cc=consulting@bugseng.com \
    --cc=jbeulich@suse.com \
    --cc=julien@xen.org \
    --cc=maria.celeste.cesario@bugseng.com \
    --cc=michal.orzel@amd.com \
    --cc=roger.pau@citrix.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.