From c8ff52f87620e43e3fbd809e6450d299b567b900 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edwin=20T=C3=B6r=C3=B6k?= Date: Wed, 4 Mar 2026 08:25:49 +0100 Subject: [PATCH] tools/tests/x86_emulator: fix undefined behaviour in shift MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes this `-fsanitize=undefined` error: ``` test_x86_emulator.c:1103:32: runtime error: left shift of 573785183 by 2 places cannot be represented in type 'int' SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior test_x86_emulator.c:1103:32 ``` Signed-off-by: Edwin Török Acked-by: Jan Beulich --- tools/tests/x86_emulator/test_x86_emulator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/tests/x86_emulator/test_x86_emulator.c b/tools/tests/x86_emulator/test_x86_emulator.c index ea507f9c3a..f30568b7f1 100644 --- a/tools/tests/x86_emulator/test_x86_emulator.c +++ b/tools/tests/x86_emulator/test_x86_emulator.c @@ -1100,7 +1100,7 @@ int main(int argc, char **argv) regs.edi = (unsigned long)res; rc = x86_emulate(&ctxt, &emulops); if ( (rc != X86EMUL_OKAY) || - (*res != ((0x2233445F << 2) | 2)) || + (*res != ((0x2233445FU << 2) | 2)) || ((regs.eflags & (EFLAGS_MASK & ~X86_EFLAGS_OF)) != EFLAGS_ALWAYS_SET) || (regs.eip != (unsigned long)&instr[3]) )