All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jan-Simon Möller" <dl9pf@gmx.de>
To: 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 01:37:48 +0200	[thread overview]
Message-ID: <200908260137.48781.dl9pf@gmx.de> (raw)
In-Reply-To: <200908260002.03066.dl9pf@gmx.de>

Thinking a bit more about this, I wonder if g2h(x) shouldn't itself always 
return NULL on x = NULL ? 

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

  reply	other threads:[~2009-08-25 23:37 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 [this message]
2009-08-26 13:40   ` Riku Voipio
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=200908260137.48781.dl9pf@gmx.de \
    --to=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.