[PATCH] x86emul: drop dead conditional from decode

Jan Beulich posted 1 patch 1 month, 1 week ago
Failed in applying to current master (apply log)
[PATCH] x86emul: drop dead conditional from decode
Posted by Jan Beulich 1 month, 1 week ago
We know that opcode_table[0x0f] is 0, there's no need to check that. Up
until ab082ffa87d5 ("x86emul: generate and make use of a canonical opcode
representation") or maybe already c4e7a67e3a10 ("x86emul: drop
SrcInvalid") this may have been justified, but it no longer is.

This eliminates a Misra C:2012 rule 2.2 ("There shall be no dead code")
violation.

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

--- a/xen/arch/x86/x86_emulate/decode.c
+++ b/xen/arch/x86/x86_emulate/decode.c
@@ -1082,7 +1082,7 @@ int x86emul_decode(struct x86_emulate_st
 
     /* Opcode byte(s). */
     d = opcode_table[b];
-    if ( d == 0 && b == 0x0f )
+    if ( b == 0x0f )
     {
         /* Two-byte opcode. */
         b = insn_fetch_type(uint8_t);
Re: [PATCH] x86emul: drop dead conditional from decode
Posted by Andrew Cooper 3 weeks ago
On 30/06/2026 2:29 pm, Jan Beulich wrote:
> We know that opcode_table[0x0f] is 0, there's no need to check that. Up
> until ab082ffa87d5 ("x86emul: generate and make use of a canonical opcode
> representation") or maybe already c4e7a67e3a10 ("x86emul: drop
> SrcInvalid") this may have been justified, but it no longer is.
>
> This eliminates a Misra C:2012 rule 2.2 ("There shall be no dead code")
> violation.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

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