[PATCH 2/2] bios_emulator: Add parens to xorl macro

Andrew Goodbody andrew.goodbody at linaro.org
Wed Jul 23 12:34:36 CEST 2025


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 at linaro.org>
---
 drivers/bios_emulator/x86emu/ops2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/bios_emulator/x86emu/ops2.c b/drivers/bios_emulator/x86emu/ops2.c
index 1ff27b2af95..29a166f7fe9 100644
--- a/drivers/bios_emulator/x86emu/ops2.c
+++ b/drivers/bios_emulator/x86emu/ops2.c
@@ -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:

-- 
2.39.5



More information about the U-Boot mailing list