Message ID | 951f634fe058ce56791f3e67f011a2218db6626d.1690788513.git.nicola.vetrini@bugseng.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | x86: address MISRA C:2012 Rule 5.3 | expand |
On 31.07.2023 09:33, Nicola Vetrini wrote: > Rule 5.3 has the following headline: > "An identifier declared in an inner scope shall not hide an > identifier declared in an outer scope" > > The declaration of local variable 'cpuid_leaf' causes > shadowing with the homonymous function to happen, therefore > the variable is renamed to avoid this. > > No functional changes. > > Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com> Acked-by: Jan Beulich <jbeulich@suse.com>
diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c index 2de1be7996..f811c1c76b 100644 --- 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 leaf; uint64_t msr_val; unsigned int i, n; unsigned long dummy; @@ -5024,13 +5024,13 @@ x86_emulate( generate_exception_if((msr_val & MSR_MISC_FEATURES_CPUID_FAULTING), X86_EXC_GP, 0); /* Faulting active? (Inc. CPL test) */ - rc = ops->cpuid(_regs.eax, _regs.ecx, &cpuid_leaf, ctxt); + rc = ops->cpuid(_regs.eax, _regs.ecx, &leaf, ctxt); if ( rc != X86EMUL_OKAY ) goto done; - _regs.r(ax) = cpuid_leaf.a; - _regs.r(bx) = cpuid_leaf.b; - _regs.r(cx) = cpuid_leaf.c; - _regs.r(dx) = cpuid_leaf.d; + _regs.r(ax) = leaf.a; + _regs.r(bx) = leaf.b; + _regs.r(cx) = leaf.c; + _regs.r(dx) = leaf.d; break; case X86EMUL_OPC(0x0f, 0xa3): bt: /* bt */
Rule 5.3 has the following headline: "An identifier declared in an inner scope shall not hide an identifier declared in an outer scope" The declaration of local variable 'cpuid_leaf' causes shadowing with the homonymous function to happen, therefore the variable is renamed to avoid this. No functional changes. Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com> --- Changes in v2: - s/res/leaf/ to have a less generic name. - Split the patch in half (see patch 4/4). --- xen/arch/x86/x86_emulate/x86_emulate.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) -- 2.34.1