Jes Sorensen wrote: > Zhang, Xiantao wrote: >>> From 62895ff991d48398a77afdbf7f2bef127e802230 Mon Sep 17 00:00:00 >>> 2001 >> From: Xiantao Zhang <xiantao.zhang@xxxxxxxxx> >> Date: Fri, 28 Mar 2008 09:49:57 +0800 >> Subject: [PATCH] KVM: IA64: Add kvm arch-specific core code for >> kvm/ia64. >> >> kvm_ia64.c is created to handle kvm ia64-specific core logic. >> Signed-off-by: Xiantao Zhang <xiantao.zhang@xxxxxxxxx> > > More comments, a couple of bugs in this one. > >> +#include <linux/module.h> >> +#include <linux/vmalloc.h> > > Don't think you need vmalloc.h here. Originally, we called vmalloc, but removed later. Maybe we can remove it now. >> +int kvm_arch_vcpu_ioctl_set_regs(struct kvm_vcpu *vcpu, struct >> kvm_regs *regs) +{ > [snip] >> + copy_from_user(&vcpu->arch.guest, regs->saved_guest, >> + sizeof(union context)); >> + copy_from_user(vcpu + 1, regs->saved_stack + sizeof(struct >> kvm_vcpu), >> + IA64_STK_OFFSET - sizeof(struct kvm_vcpu)); > > You need to check the return values from copy_from_user() here and > deal with possible failure. > >> + vcpu->arch.apic = kzalloc(sizeof(struct kvm_lapic), GFP_KERNEL); >> + vcpu->arch.apic->vcpu = vcpu; > > Whoops! Missing NULL pointer check here after the kzalloc. Good catch. Fixed! >> + copy_to_user(regs->saved_guest, &vcpu->arch.guest, >> + sizeof(union context)); + copy_to_user(regs->saved_stack, >> (void *)vcpu, IA64_STK_OFFSET); > > Same problem as above - check the return values. -- To unsubscribe from this list: send the line "unsubscribe linux-ia64" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html
![]() |