Skip to contentSkip to conversation

x86emul: drop dead conditional from decode

PATCH In review Jan Beulich 2 participants 2 messages Jun 30 – Jul 20

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86emul: drop dead conditional from decode

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.

xen/arch/x86/x86_emulate/decode.c +1 -1
@@ -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);
Acked-by on v1 1/1
#1 lore raw
Quoted 9 lines · Jan Beulich

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.