[PATCH kvm-unit-tests] x86: realmode: use ARRAY_SIZE in test_long_jmp

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Make the code a little bit more robust and self-explanatory.

Signed-off-by: Paolo Bonzini <pbonzini@xxxxxxxxxx>
---
 x86/realmode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/x86/realmode.c b/x86/realmode.c
index a1df515..5dbc2aa 100644
--- a/x86/realmode.c
+++ b/x86/realmode.c
@@ -606,7 +606,7 @@ static void test_long_jmp(void)
 	u32 esp[16];
 
 	inregs = (struct regs){ 0 };
-	inregs.esp = (u32)(esp+16);
+	inregs.esp = (u32)&esp[ARRAY_SIZE(esp)];
 	MK_INSN(long_jmp, "call 1f\n\t"
 			  "jmp 2f\n\t"
 			  "1: jmp $0, $test_function\n\t"
-- 
2.21.0




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux