bios_emulator: Add parens to xorl macro
authorAndrew Goodbody <andrew.goodbody@linaro.org>
Wed, 23 Jul 2025 10:34:36 +0000 (11:34 +0100)
committerTom Rini <trini@konsulko.com>
Tue, 29 Jul 2025 19:14:47 +0000 (13:14 -0600)
The xorl macro lacked surrounding parens which meant that it could have
unexpected results when used in expressions. Fix this by adding the
surrounding parens to make its use predictable.

This issue was found by Smatch.

Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
drivers/bios_emulator/x86emu/ops2.c

index 1ff27b2..29a166f 100644 (file)
@@ -66,7 +66,7 @@ void x86emuOp2_illegal_op(
     END_OF_INSTR();
 }
 
-#define xorl(a,b)   ((a) && !(b)) || (!(a) && (b))
+#define xorl(a, b)   (((a) && !(b)) || (!(a) && (b)))
 
 /****************************************************************************
 REMARKS: