From: Jes Sorensen <jes@sgi.com>
To: "Zhang, Xiantao" <xiantao.zhang@intel.com>
Cc: Avi Kivity <avi@qumranet.com>, "Luck, Tony" <tony.luck@intel.com>,
"Xu, Anthony" <anthony.xu@intel.com>,
Akio Takebe <takebe_akio@jp.fujitsu.com>,
kvm-devel@lists.sourceforge.net,
kvm-ia64-devel@lists.sourceforge.net, linux-ia64@vger.kernel.org,
virtualization@lists.linux-foundation.org,
Carsten Otte <cotte@de.ibm.com>
Subject: Re: [04/17] [PATCH] Add kvm arch-specific core code for kvm/ia64.-V8
Date: Mon, 31 Mar 2008 14:01:59 +0200 [thread overview]
Message-ID: <47F0D2B7.7080607@sgi.com> (raw)
In-Reply-To: <42DFA526FC41B1429CE7279EF83C6BDC01048245@pdsmsx415.ccr.corp.intel.com>
Zhang, Xiantao wrote:
>>From 62895ff991d48398a77afdbf7f2bef127e802230 Mon Sep 17 00:00:00 2001
> From: Xiantao Zhang <xiantao.zhang@intel.com>
> 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@intel.com>
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.
> +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.
> + 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.
Cheers,
Jes
next prev parent reply other threads:[~2008-03-31 12:01 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-31 8:26 [04/17] [PATCH] Add kvm arch-specific core code for kvm/ia64.-V8 Zhang, Xiantao
2008-03-31 12:01 ` Jes Sorensen [this message]
2008-04-01 1:31 ` Zhang, Xiantao
2008-03-31 14:52 ` Carsten Otte
2008-04-01 1:51 ` Zhang, Xiantao
2008-04-01 2:16 ` Zhang, Xiantao
2008-04-01 7:53 ` Carsten Otte
2008-04-01 9:43 ` Zhang, Xiantao
2008-04-01 10:59 ` Carsten Otte
2008-04-01 11:05 ` Zhang, Xiantao
2008-04-01 11:49 ` Carsten Otte
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=47F0D2B7.7080607@sgi.com \
--to=jes@sgi.com \
--cc=anthony.xu@intel.com \
--cc=avi@qumranet.com \
--cc=cotte@de.ibm.com \
--cc=kvm-devel@lists.sourceforge.net \
--cc=kvm-ia64-devel@lists.sourceforge.net \
--cc=linux-ia64@vger.kernel.org \
--cc=takebe_akio@jp.fujitsu.com \
--cc=tony.luck@intel.com \
--cc=virtualization@lists.linux-foundation.org \
--cc=xiantao.zhang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox