Jes Sorensen wrote: > Zhang, Xiantao wrote: >>> From 62895ff991d48398a77afdbf7f2bef127e802230 Mon Sep 17 00:00:00 >>> 2001 >> From: Xiantao Zhang <[EMAIL PROTECTED]> >> 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 <[EMAIL PROTECTED]> > > 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. ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace _______________________________________________ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel