All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nicola Vetrini <nicola.vetrini@bugseng.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: sstabellini@kernel.org, michal.orzel@amd.com,
	xenia.ragiadakou@amd.com, ayan.kumar.halder@amd.com,
	consulting@bugseng.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: [XEN PATCH 4/4] x86: avoid shadowing to address MISRA C:2012 Rule 5.3
Date: Thu, 27 Jul 2023 17:58:29 +0200	[thread overview]
Message-ID: <da8ca9ee-d60b-a765-35ff-944b51f940f7@bugseng.com> (raw)
In-Reply-To: <fdd04423-f38d-1575-62e7-4d452e396c51@suse.com>



On 27/07/23 17:41, Jan Beulich wrote:
> On 27.07.2023 12:48, Nicola Vetrini wrote:
>> --- a/xen/arch/x86/x86_emulate/x86_emulate.c
>> +++ b/xen/arch/x86/x86_emulate/x86_emulate.c
>> @@ -1483,7 +1483,7 @@ x86_emulate(
>>       {
>>           enum x86_segment seg;
>>           struct segment_register cs, sreg;
>> -        struct cpuid_leaf cpuid_leaf;
>> +        struct cpuid_leaf res;
> 
> This is too generic a name for a variable with a scope of several
> thousand lines. Perhaps just "leaf"?

It can also be defined inside the switch clause, since it has no other 
purpose than store a result.

> 
>> @@ -8408,8 +8408,6 @@ x86_emulate(
>>           generate_exception(X86_EXC_MF);
>>       if ( stub_exn.info.fields.trapnr == X86_EXC_XM )
>>       {
>> -        unsigned long cr4;
>> -
>>           if ( !ops->read_cr || ops->read_cr(4, &cr4, ctxt) != X86EMUL_OKAY )
>>               cr4 = X86_CR4_OSXMMEXCPT;
>>           generate_exception(cr4 & X86_CR4_OSXMMEXCPT ? X86_EXC_XM : X86_EXC_UD);
> 
> This change looks okay to me, but I'd like to strongly encourage
> you to split both changes. They're of different nature, and for
> the latter it may even be worthwhile pointing out when exactly
> this duplication of variables was introduced (it clearly would
> better have been avoided).
> 

I did it this way because they are the only violations of R5.3 left in 
this file (among those not subject to deviation). By splitting you mean 
two patches in this series or a separate patch just for this change?

-- 
Nicola Vetrini, BSc
Software Engineer, BUGSENG srl (https://bugseng.com)


  reply	other threads:[~2023-07-27 15:58 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-27 10:47 [XEN PATCH 0/4] address violations of MISRA C:2012 Rule 5.3 on x86 Nicola Vetrini
2023-07-27 10:45 ` [XEN PATCH 3/4] x86/mm: mechanically rename variable to avoid shadowing Nicola Vetrini
2023-07-27 10:48   ` Nicola Vetrini
2023-07-27 15:34   ` Jan Beulich
2023-07-27 10:47 ` [XEN PATCH 1/4] x86: mechanically rename to address MISRA C:2012 Rule 5.3 Nicola Vetrini
2023-07-27 14:50   ` Jan Beulich
2023-07-27 15:00     ` Andrew Cooper
2023-07-27 15:18       ` Nicola Vetrini
2023-07-27 10:48 ` [XEN PATCH 2/4] x86/emulate: move a variable declaration " Nicola Vetrini
2023-07-27 15:06   ` Jan Beulich
2023-07-27 15:22     ` Nicola Vetrini
2023-07-27 15:31       ` Jan Beulich
2023-07-27 15:35         ` Nicola Vetrini
2023-07-27 10:48 ` [XEN PATCH 4/4] x86: avoid shadowing " Nicola Vetrini
2023-07-27 15:41   ` Jan Beulich
2023-07-27 15:58     ` Nicola Vetrini [this message]
2023-07-27 16:04       ` Jan Beulich
2023-07-27 10:48 ` [XEN PATCH 0/4] address violations of MISRA C:2012 Rule 5.3 on x86 Nicola Vetrini

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=da8ca9ee-d60b-a765-35ff-944b51f940f7@bugseng.com \
    --to=nicola.vetrini@bugseng.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=ayan.kumar.halder@amd.com \
    --cc=consulting@bugseng.com \
    --cc=jbeulich@suse.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 \
    --cc=xenia.ragiadakou@amd.com \
    /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.