|
[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()
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.
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |