On Wed, 13 Jan 2010 11:22:39 +0200 Avi Kivity <a...@redhat.com> wrote:

> On 01/13/2010 12:11 AM, a...@linux-foundation.org wrote:
> > Subject: kvm/ia64: dereference of NULL pointer in set_pal_result()
> > From: Roel Kluin<roel.kl...@gmail.com>
> >
> > Do not dereference a NULL pointer
> >
> > diff -puN 
> > arch/ia64/kvm/kvm_fw.c~kvm-ia64-dereference-of-null-pointer-in-set_pal_result
> >  arch/ia64/kvm/kvm_fw.c
> > --- 
> > a/arch/ia64/kvm/kvm_fw.c~kvm-ia64-dereference-of-null-pointer-in-set_pal_result
> > +++ a/arch/ia64/kvm/kvm_fw.c
> > @@ -75,9 +75,11 @@ static void set_pal_result(struct kvm_vc
> >     struct exit_ctl_data *p;
> >
> >     p = kvm_get_exit_data(vcpu);
> > -   if (p&&  p->exit_reason == EXIT_REASON_PAL_CALL) {
> > +   if (!p)
> > +           return;
> > +   if (p->exit_reason == EXIT_REASON_PAL_CALL) {
> >             p->u.pal_data.ret = result;
> > -           return ;
> > +           return;
> >     }
> >     INIT_PAL_STATUS_UNIMPLEMENTED(p->u.pal_data.ret);
> >   }
> >    
> 
> 
> kvm_get_exit_data() cannot return a NULL pointer.

In that case set_pal_result() doesn't need to test for that.

Roel looks for code along the lines of

        if (p)
                ...

        *p;

> Where did this come from?

I got it off linux-kernel.
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to