[XEN PATCH v2 4/4] x86emul: remove local variable to address MISRA C:2012 Rule 5.3

Nicola Vetrini posted 4 patches 2 years, 6 months ago
There is a newer version of this series
[XEN PATCH v2 4/4] x86emul: remove local variable to address MISRA C:2012 Rule 5.3
Posted by Nicola Vetrini 2 years, 6 months ago
The local variable removed by this commit shadowed another declared in
an outer scope and thus violates Rule 5.3. It was introduced as part of
a refactoring by commit abf5fb62f73d0dbeabc6a8cd6dbb55174b36c8d1.

No functional changes.

Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
---
 xen/arch/x86/x86_emulate/x86_emulate.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index f811c1c76b..60bd2f8d8e 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -8408,8 +8408,6 @@ x86_emulate(
         generate_exception(X86_EXC_MF);
     if ( stub_exn.info.fields.trapnr == X86_EXC_XM )
     {
-        unsigned long cr4;
-
         if ( !ops->read_cr || ops->read_cr(4, &cr4, ctxt) != X86EMUL_OKAY )
             cr4 = X86_CR4_OSXMMEXCPT;
         generate_exception(cr4 & X86_CR4_OSXMMEXCPT ? X86_EXC_XM : X86_EXC_UD);
-- 
2.34.1
Re: [XEN PATCH v2 4/4] x86emul: remove local variable to address MISRA C:2012 Rule 5.3
Posted by Jan Beulich 2 years, 6 months ago
On 31.07.2023 09:33, Nicola Vetrini wrote:
> The local variable removed by this commit shadowed another declared in
> an outer scope and thus violates Rule 5.3. It was introduced as part of
> a refactoring by commit abf5fb62f73d0dbeabc6a8cd6dbb55174b36c8d1.
> 
> No functional changes.
> 
> Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>

Reviewed-by: Jan Beulich <jbeulich@suse.com>

Albeit, just to mention it, the description could have done with making
clear why the removal is actually correct (nothing like this can be
inferred from pointing at the variable's introduction). But well ...

Jan