From: Riku Voipio <riku.voipio@iki.fi>
To: "Jan-Simon Möller" <dl9pf@gmx.de>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [Patch] linux-user/syscall.c - don't add GUEST_BASE to NULL pointer
Date: Wed, 26 Aug 2009 16:40:43 +0300 [thread overview]
Message-ID: <20090826134043.GB7862@kos.to> (raw)
In-Reply-To: <200908260137.48781.dl9pf@gmx.de>
On Wed, Aug 26, 2009 at 01:37:48AM +0200, Jan-Simon Möller wrote:
> Thinking a bit more about this, I wonder if g2h(x) shouldn't itself always
> return NULL on x = NULL ?
I agree this seems like a a better idea than modifying the users of g2h.
> Something like:
>
> Signed-off-by: Jan-Simon Möller <dl9pf@gmx.de>
>
> diff --git a/cpu-all.h b/cpu-all.h
> index 1a6a812..631f678 100644
> --- a/cpu-all.h
> +++ b/cpu-all.h
> @@ -633,7 +633,7 @@ extern int have_guest_base;
> #endif
>
> /* All direct uses of g2h and h2g need to go away for usermode softmmu. */
> -#define g2h(x) ((void *)((unsigned long)(x) + GUEST_BASE))
> +#define g2h(x) ( !x ? NULL:((void *)((unsigned long)(x) + GUEST_BASE)))
> #define h2g(x) ({ \
> unsigned long __ret = (unsigned long)(x) - GUEST_BASE; \
> /* Check if given address fits target address space */ \
>
>
> I read the comment above, but before replacing it in user-mode (if possible),
> we should fix it ;) .
>
>
> Best,
> Jan-Simon
>
>
>
next prev parent reply other threads:[~2009-08-26 13:40 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-25 22:02 [Qemu-devel] [Patch] linux-user/syscall.c - don't add GUEST_BASE to NULL pointer Jan-Simon Möller
2009-08-25 23:37 ` Jan-Simon Möller
2009-08-26 13:40 ` Riku Voipio [this message]
2009-08-26 19:58 ` Jan-Simon Möller
2009-08-28 13:20 ` Jan-Simon Möller
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=20090826134043.GB7862@kos.to \
--to=riku.voipio@iki.fi \
--cc=dl9pf@gmx.de \
--cc=qemu-devel@nongnu.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.