summaryrefslogtreecommitdiff
path: root/drivers/kvm/vmx.c
diff options
context:
space:
mode:
authorEric Sesterhenn / Snakebyte <snakebyte@gmx.de>2007-04-09 16:15:05 +0200
committerAvi Kivity <avi@qumranet.com>2007-05-03 10:52:29 +0300
commit3964994bb5ba85a3d8b54ae618f7be1cecce916d (patch)
treed093a2be86855e37abe7783e257eac4d9eb0ae73 /drivers/kvm/vmx.c
parent5008fdf5b6a31240da060c0867d8f16f08ce2384 (diff)
downloadlwn-3964994bb5ba85a3d8b54ae618f7be1cecce916d.tar.gz
lwn-3964994bb5ba85a3d8b54ae618f7be1cecce916d.zip
KVM: Fix overflow bug in overflow detection code
The expression sp - 6 < sp where sp is a u16 is undefined in C since 'sp - 6' is promoted to int, and signed overflow is undefined in C. gcc 4.2 actually warns about it. Replace with a simpler test. Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de> Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'drivers/kvm/vmx.c')
-rw-r--r--drivers/kvm/vmx.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/kvm/vmx.c b/drivers/kvm/vmx.c
index 61a611691e50..8c0115b54802 100644
--- a/drivers/kvm/vmx.c
+++ b/drivers/kvm/vmx.c
@@ -1182,7 +1182,7 @@ static void inject_rmode_irq(struct kvm_vcpu *vcpu, int irq)
u16 sp = vmcs_readl(GUEST_RSP);
u32 ss_limit = vmcs_read32(GUEST_SS_LIMIT);
- if (sp > ss_limit || sp - 6 > sp) {
+ if (sp > ss_limit || sp < 6 ) {
vcpu_printf(vcpu, "%s: #SS, rsp 0x%lx ss 0x%lx limit 0x%x\n",
__FUNCTION__,
vmcs_readl(GUEST_RSP),