[PATCH v3] x86/PV: drop a local variable from pv_emulate_gate_op()

Jan Beulich posted 1 patch 5 days, 13 hours ago
Failed in applying to current master (apply log)
[PATCH v3] x86/PV: drop a local variable from pv_emulate_gate_op()
Posted by Jan Beulich 5 days, 13 hours ago
The inner "rc" shadows the 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"). Drop the inner variable, as
there's no other (later) use of the value it holds.

No difference in generated code.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
v3: Use alternative approach.
v2: Re-base.

--- unstable.orig/xen/arch/x86/pv/emul-gate-op.c	2026-06-02 15:15:17.960392177 +0200
+++ unstable/xen/arch/x86/pv/emul-gate-op.c	2026-06-02 15:40:58.000000000 +0200
@@ -287,7 +287,6 @@ void pv_emulate_gate_op(struct cpu_user_
     {
         unsigned int ss, esp, *stkp;
         uint32_t value;
-        int rc;
 #define push(item) do \
         { \
             value = (item); \
Re: [PATCH v3] x86/PV: drop a local variable from pv_emulate_gate_op()
Posted by Oleksii Kurochko 5 days, 12 hours ago

On 6/2/26 3:52 PM, Jan Beulich wrote:
> The inner "rc" shadows the 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"). Drop the inner variable, as
> there's no other (later) use of the value it holds.
> 
> No difference in generated code.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> ---
> v3: Use alternative approach.
> v2: Re-base.
> 
> --- unstable.orig/xen/arch/x86/pv/emul-gate-op.c	2026-06-02 15:15:17.960392177 +0200
> +++ unstable/xen/arch/x86/pv/emul-gate-op.c	2026-06-02 15:40:58.000000000 +0200
> @@ -287,7 +287,6 @@ void pv_emulate_gate_op(struct cpu_user_
>       {
>           unsigned int ss, esp, *stkp;
>           uint32_t value;
> -        int rc;
>   #define push(item) do \
>           { \
>               value = (item); \

Release-Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>

Thanks.

~ Oleksii
Re: [PATCH v3] x86/PV: drop a local variable from pv_emulate_gate_op()
Posted by Andrew Cooper 5 days, 12 hours ago
On 02/06/2026 2:52 pm, Jan Beulich wrote:
> The inner "rc" shadows the 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"). Drop the inner variable, as
> there's no other (later) use of the value it holds.
>
> No difference in generated code.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>