Commit-ID: 7e18c4031a99011e2c21c2616b77c0c9c099036c Gitweb: http://git.kernel.org/tip/7e18c4031a99011e2c21c2616b77c0c9c099036c Author: Matt Evans <matt@xxxxxxxxxx> AuthorDate: Wed, 14 Dec 2011 13:06:44 +1100 Committer: Pekka Enberg <penberg@xxxxxxxxxx> CommitDate: Thu, 15 Dec 2011 08:31:27 +0200 kvm tools: Fix alaising errors in LINT assignment I'm getting this on x86-32, gcc 4.4.3: CC x86/kvm-cpu.o cc1: warnings being treated as errors x86/kvm-cpu.c: In function ‘kvm_cpu__set_lint’: x86/kvm-cpu.c:89: error: dereferencing pointer ‘lapic’ does break strict-aliasing rules x86/kvm-cpu.c:88: error: dereferencing pointer ‘lapic’ does break strict-aliasing rules x86/kvm-cpu.c:83: note: initialized from here make: *** [x86/kvm-cpu.o] Error 1 Removing the nasty aliasing seems to be a good way to go. Acked-by: Sasha Levin <levinsasha928@xxxxxxxxx> Signed-off-by: Matt Evans <matt@xxxxxxxxxx> Signed-off-by: Pekka Enberg <penberg@xxxxxxxxxx> --- tools/kvm/x86/kvm-cpu.c | 11 +++++------ 1 files changed, 5 insertions(+), 6 deletions(-) diff --git a/tools/kvm/x86/kvm-cpu.c b/tools/kvm/x86/kvm-cpu.c index cc1f560..30f1ad6 100644 --- a/tools/kvm/x86/kvm-cpu.c +++ b/tools/kvm/x86/kvm-cpu.c @@ -79,16 +79,15 @@ void kvm_cpu__delete(struct kvm_cpu *vcpu) static int kvm_cpu__set_lint(struct kvm_cpu *vcpu) { - struct kvm_lapic_state klapic; - struct local_apic *lapic = (void *)&klapic; + struct local_apic lapic; - if (ioctl(vcpu->vcpu_fd, KVM_GET_LAPIC, &klapic)) + if (ioctl(vcpu->vcpu_fd, KVM_GET_LAPIC, &lapic)) return -1; - lapic->lvt_lint0.delivery_mode = APIC_MODE_EXTINT; - lapic->lvt_lint1.delivery_mode = APIC_MODE_NMI; + lapic.lvt_lint0.delivery_mode = APIC_MODE_EXTINT; + lapic.lvt_lint1.delivery_mode = APIC_MODE_NMI; - return ioctl(vcpu->vcpu_fd, KVM_SET_LAPIC, &klapic); + return ioctl(vcpu->vcpu_fd, KVM_SET_LAPIC, &lapic); } struct kvm_cpu *kvm_cpu__init(struct kvm *kvm, unsigned long cpu_id) -- To unsubscribe from this list: send the line "unsubscribe linux-tip-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html