[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [XEN PATCH 4/4] x86: avoid shadowing to address MISRA C:2012 Rule 5.3


  • To: Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 27 Jul 2023 17:41:48 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=YKVdVXlAIMVHz+hMlPBYJGjGrc/dnOs6dpQqQ4ePrA4=; b=ftjqTRXi/ough7uYp26fiWFEvaoyD+Xfv2V/Mwl9vjyw45ob1m0BiEfwturWubUIWuVb0n9MX+ryZJpo/ITEzB3cT9GwA5gazZz8hAuGieXGjZJ6uE+VMgQb7nbs+J8HEWvHzYW+LKYgd0PzmGKJDnlrNU6SIYGojV0+e4qyavTQJRWmyWLqxNuNx1ttRhxouwiOKIhN2QYK+QUrU8TiVL1B9EsCc5Apfm+eoj5/20vHD9c61eR4Kpcx2Skp/iVrzHELbIDq4wSzfNczRqY6HiPOd2Kcf6Xa52T65Vifu1sDwJFltrevD4N5ZzFj3oatEyS3XIjYpsSaNg7O/nOIqw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HmJCbmUO6k0Rna10gg2mFfP5zTDx7IvRV+m5j1jiEExIV55dm4GopBy4OZ2kDk3gRujChNYvBIvwbuqY7X8K5ERq5Xl/c3qJWn2js6719PV0JyBKLY326JLRqj2739js3wmwvCZIAmUzaGEW2uARaICmCNxLdB4dANtDns1JB/3oPd1ydh+xF6l9+gWft+2e28pYngi3QYg72Z9zDv3bF1RFJpmHapfVczwrh69tBL+T4P0lcrbZV5wGF6a28dKJd+uLXxtOUN4C/nKyY4mlp17/LeOxPjiTbaj7ComeL3B0haK9XyBVIvhiHOPqc+QXsYNF8lp5E94hVuwtKZrLkQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: sstabellini@xxxxxxxxxx, michal.orzel@xxxxxxx, xenia.ragiadakou@xxxxxxx, ayan.kumar.halder@xxxxxxx, consulting@xxxxxxxxxxx, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Thu, 27 Jul 2023 15:42:37 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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

> @@ -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).

Jan



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.