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); \
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
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>
© 2016 - 2026 Red Hat, Inc.