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

Re: [PATCH 2/5] x86/PV: rename a local variable in pv_emulate_gate_op()


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Fri, 22 May 2026 12:24:00 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=kDjxz7Uh0bEn7RrIjWauvVOuI4TTMgRfhG9fGDNH37s=; b=Qia8ExJS9JVEp1onw6Nhk2VYkFo619yUDJq/AfbqArMpJbIm1F/KW64AMPQiGM8WgXJ69qumsB+8lWilVVDfHJ5CWSbBVUOWIYznzriVd+Nl4NUPA8S6exaySjshrDniGekK+DMvXhlcCZD14ZxoJtyw6eHOudZE/c8U4MWlfn0gf9u2DLEx0pGYCcKpLAEpgmeOkGUquzybyPdKWno/4CNsFy9zSAmhjKVd0KwnMQYrJuwSnq0IcWSEU/SzXVoK1Ju5AqVEfnWdSFu0ywqDApM1AXTpGDvkvmXvxCyfXqJBFy/FhzXv02s+Uu54jr3B4WGd27sD077D/5Y5WhtoRA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=AhgMmCP5Qv0fqNSVoHabiKqs7UuLKub3OJmjacP0Vbj7z31AOx78CVBGSglcG3PaLAO5Pttmg/DbcRQV6fEaG7nTXDrSGAEEnlXL2aLX9sfJfFO7HxUmrUb/3fSpQQojCp6l85lSwgXWPkO/JR+TwmaQWruCPUeXPqV2nPFio1HX7mnKNuQwTL3XPAaTUPIeuXVWvFq/SLRIsQSka/kHqDF3v4dVdOFPgO4ByBqz39TgbJRWnMd9sToFhs4Uf4K01sMvWxE4NuYTykAdunKxoMEaBr1eoySxSBMqqyG4xCOwxe/S2pftaM5RuMJg3OI83evZGMNBhwG96k88F5iATg==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=citrix.com header.i="@citrix.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Teddy Astie <teddy.astie@xxxxxxxxxx>
  • Delivery-date: Fri, 22 May 2026 10:24:10 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Wed, May 13, 2026 at 01:44:47PM +0200, Jan Beulich wrote:
> ... shadowing a function scope one, thus violating Misra C:2012 rule 5.3
> ("An identifier declared in an inner scope shall not hide an identifier
> declared in an outer scope"). No difference in generated code.
> 
> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
> ---
> Technically, as the outer scope "rc" isn't used again later, we could
> simply drop the inner decl. That seemed more error prone to me, though.
> 
> --- a/xen/arch/x86/pv/emul-gate-op.c
> +++ b/xen/arch/x86/pv/emul-gate-op.c
> @@ -286,16 +286,16 @@ void pv_emulate_gate_op(struct cpu_user_
>      if ( !jump )
>      {
>          unsigned int ss, esp, *stkp;
> -        int rc;
> +        int left;
>  #define push(item) do \
>          { \
>              --stkp; \
>              esp -= 4; \
> -            rc = __put_guest(item, stkp); \
> -            if ( rc ) \
> +            left = __put_guest(item, stkp); \
> +            if ( left ) \
>              { \
>                  pv_inject_page_fault(PFEC_write_access, \
> -                                     (unsigned long)(stkp + 1) - rc); \
> +                                     (unsigned long)(stkp + 1) - left); \
>                  return; \
>              } \
>          } while ( 0 )
> @@ -359,10 +359,11 @@ void pv_emulate_gate_op(struct cpu_user_
>                      unsigned int parm;
>  
>                      --ustkp;
> -                    rc = __get_guest(parm, ustkp);
> -                    if ( rc )
> +                    left = __get_guest(parm, ustkp);
> +                    if ( left )
>                      {
> -                        pv_inject_page_fault(0, (unsigned long)(ustkp + 1) - 
> rc);
> +                        pv_inject_page_fault(0,
> +                                             (unsigned long)(ustkp + 1) - 
> left);

__{put,get}_guest() return -EFAULT on error, and hence the
addition/subtraction here is wrong AFAICT.

Thanks, Roger.



 


Rackspace

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