kvm: svm: fix unsigned compare less than zero comparison
authorColin Ian King <colin.king@canonical.com>
Mon, 19 Sep 2016 06:11:59 +0000 (07:11 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 20 Sep 2016 07:26:30 +0000 (09:26 +0200)
commitadad0d02a7d3c958121a4eb9d126015a2353db94
treeff0350eccccf62fb4d4515cc06120f6c825869c2
parent095cf55df715d14d5dad75326faf5984e7fc0b3a
kvm: svm: fix unsigned compare less than zero comparison

vm_data->avic_vm_id is a u32, so the check for a error
return (less than zero) such as -EAGAIN from
avic_get_next_vm_id currently has no effect whatsoever.
Fix this by using a temporary int for the comparison
and assign vm_data->avic_vm_id to this. I used an explicit
u32 cast in the assignment to show why vm_data->avic_vm_id
cannot be used in the assign/compare steps.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Joerg Roedel <jroedel@suse.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/svm.c