kvm/apic: correct short memset

kvm_put_apic_state's attempt to clear *kapic before setting its
bits cleared sizeof(void*) bytes (no more than 8) rather than the
intended 1024 (KVM_APIC_REG_SIZE) bytes. Spotted by coverity.

Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
This commit is contained in:
Jim Meyering 2012-05-10 18:19:47 +02:00 committed by Avi Kivity
parent dbaf26b3b2
commit 0614cb82ca
1 changed files with 1 additions and 1 deletions

View File

@ -30,7 +30,7 @@ void kvm_put_apic_state(DeviceState *d, struct kvm_lapic_state *kapic)
APICCommonState *s = DO_UPCAST(APICCommonState, busdev.qdev, d); APICCommonState *s = DO_UPCAST(APICCommonState, busdev.qdev, d);
int i; int i;
memset(kapic, 0, sizeof(kapic)); memset(kapic, 0, sizeof(*kapic));
kvm_apic_set_reg(kapic, 0x2, s->id << 24); kvm_apic_set_reg(kapic, 0x2, s->id << 24);
kvm_apic_set_reg(kapic, 0x8, s->tpr); kvm_apic_set_reg(kapic, 0x8, s->tpr);
kvm_apic_set_reg(kapic, 0xd, s->log_dest << 24); kvm_apic_set_reg(kapic, 0xd, s->log_dest << 24);