public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
To: Nguyen Anh Quynh <aquynh-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: Re: [PATCH] memslot check before deferencing
Date: Mon, 04 Jun 2007 12:45:25 +0300	[thread overview]
Message-ID: <4663DF35.4080005@qumranet.com> (raw)
In-Reply-To: <9cde8bff0706031016r76fc236dga185be728f0e2f4e-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

Nguyen Anh Quynh wrote:
> "memslot" in makr_page_dirty() should be verified before dereferencing
> it (kvm_main.c)

The patches still don't show up inlined.  This makes them hard to 
review.  Please fix this.

> diff --git a/kernel/kvm_main.c b/kernel/kvm_main.c
> index 84f95e4..da596fb 100644
> --- a/kernel/kvm_main.c
> +++ b/kernel/kvm_main.c
> @@ -969,16 +969,16 @@ EXPORT_SYMBOL_GPL(gfn_to_page);
>  void mark_page_dirty(struct kvm *kvm, gfn_t gfn)
>  {
>      int i;
> -    struct kvm_memory_slot *memslot = NULL;
> +    struct kvm_memory_slot *memslot;
>      unsigned long rel_gfn;
>  
>      for (i = 0; i < kvm->nmemslots; ++i) {
>          memslot = &kvm->memslots[i];
>  
> -        if (gfn >= memslot->base_gfn
> +        if (memslot && gfn >= memslot->base_gfn

memslot can not be NULL here.

>              && gfn < memslot->base_gfn + memslot->npages) {
>  
> -            if (!memslot || !memslot->dirty_bitmap)

this is odd.

> +            if (!memslot->dirty_bitmap)
>                  return;
>  
>              rel_gfn = gfn - memslot->base_gfn;



-- 
error compiling committee.c: too many arguments to function


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

  parent reply	other threads:[~2007-06-04  9:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-03 17:16 [PATCH] memslot check before deferencing Nguyen Anh Quynh
     [not found] ` <9cde8bff0706031016r76fc236dga185be728f0e2f4e-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2007-06-04  9:45   ` Avi Kivity [this message]
     [not found]     ` <4663DF35.4080005-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-06-05  2:36       ` Nguyen Anh Quynh
     [not found]         ` <9cde8bff0706041936q1b29d7a5tc31bc1c6990e6df5-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2007-06-05  7:35           ` Avi Kivity

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=4663DF35.4080005@qumranet.com \
    --to=avi-atkuwr5tajbwk0htik3j/w@public.gmane.org \
    --cc=aquynh-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    /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