diff mbox series

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

Message ID d9ab52ae16d3c9a780403906db52b42f24c1e60a.1690788513.git.nicola.vetrini@bugseng.com (mailing list archive)
State Superseded
Headers show
Series x86: address MISRA C:2012 Rule 5.3 | expand

Commit Message

Nicola Vetrini July 31, 2023, 7:33 a.m. UTC
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(-)

Comments

Jan Beulich July 31, 2023, 11:53 a.m. UTC | #1
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
diff mbox series

Patch

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);