All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yaniv Kamay <ykamay@redhat.com>
To: Glauber Costa <glommer@gmail.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH] fix bad physical address in kvm_update_dirty_pages_log()
Date: Tue, 24 Mar 2009 23:27:10 +0200	[thread overview]
Message-ID: <49C9502E.7070907@redhat.com> (raw)
In-Reply-To: <5d6222a80903241413n6f1a472fp4a546b1cac6fadd4@mail.gmail.com>

Glauber Costa wrote:
> @@ -1223,12 +1244,44 @@ static int kvm_get_dirty_bitmap_cb(unsigned
> long start, unsigned long len,
>  int kvm_update_dirty_pages_log(void)
>  {
>      int r = 0;
> +    ram_addr_t now = 0;
> +    ram_addr_t end = phys_ram_size;
> +    ram_addr_t offset;
> +    target_phys_addr_t area_start;
> +    ram_addr_t area_size;
> +    unsigned char *dirty_bitmap = kvm_dirty_bitmap;
> +
> +    if (!dirty_bitmap) {
> +        printf("%s: no dirty bitmap\n", __FUNCTION__);
> +        return -1;
> +    }
> nitpick: you probably want fprintf(stderr...).
>
>
> +    while (now < end && !find_phys_area(now, &offset, &area_start,
> &area_size)) {
> +        if ((offset & ~TARGET_PAGE_MASK) || (area_start &
> ~TARGET_PAGE_MASK) ||
> +                                                         (area_size &
> ~TARGET_PAGE_MASK)) {
> +            printf("%s: invalid mem area\n", __FUNCTION__);
> same here.
>
>
>
> +        if ((now += offset) >= end) {
> +            break;
> +        }
> +
> +        if (area_size > end - now) {
> +            return -1;
> +        }
> any reason why you're handling those two differently?
>   
The first is orderly end of mappings and the later is error.
> --
> Glauber  Costa.
> "Free as in Freedom"
> http://glommer.net
>
> "The less confident you are, the more serious you have to act."
>   


  reply	other threads:[~2009-03-24 21:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-24 21:01 [PATCH] fix bad physical address in kvm_update_dirty_pages_log() Yaniv Kamay
2009-03-24 21:13 ` Glauber Costa
2009-03-24 21:27   ` Yaniv Kamay [this message]
2009-03-24 21:30     ` Glauber Costa
2009-03-25 12:27 ` 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=49C9502E.7070907@redhat.com \
    --to=ykamay@redhat.com \
    --cc=glommer@gmail.com \
    --cc=kvm@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.