From patchwork Tue Aug 25 23:37:48 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Jan-Simon_M=C3=B6ller?= X-Patchwork-Id: 32100 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by bilbo.ozlabs.org (Postfix) with ESMTPS id 02090B7BA1 for ; Wed, 26 Aug 2009 09:38:37 +1000 (EST) Received: from localhost ([127.0.0.1]:47714 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mg5av-0007ct-QW for incoming@patchwork.ozlabs.org; Tue, 25 Aug 2009 19:38:29 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mg5aQ-0007aG-GE for qemu-devel@nongnu.org; Tue, 25 Aug 2009 19:37:58 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mg5aK-0007SO-Qr for qemu-devel@nongnu.org; Tue, 25 Aug 2009 19:37:58 -0400 Received: from [199.232.76.173] (port=44179 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mg5aK-0007Ry-OA for qemu-devel@nongnu.org; Tue, 25 Aug 2009 19:37:52 -0400 Received: from mail.gmx.net ([213.165.64.20]:40894) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1Mg5aK-0008Vn-05 for qemu-devel@nongnu.org; Tue, 25 Aug 2009 19:37:52 -0400 Received: (qmail invoked by alias); 25 Aug 2009 23:37:50 -0000 Received: from ip180156.wh.uni-hannover.de (EHLO ip180156.wh.uni-hannover.de) [130.75.180.156] by mail.gmx.net (mp067) with SMTP; 26 Aug 2009 01:37:50 +0200 X-Authenticated: #7313500 X-Provags-ID: V01U2FsdGVkX18U6vcGhboU7mNIbBMGrAWQWrEU8FgEx+5DPxyoY9 1sF06/Y/y0WNfx From: "Jan-Simon =?utf-8?q?M=C3=B6ller?=" 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 User-Agent: KMail/1.9.9 References: <200908260002.03066.dl9pf@gmx.de> In-Reply-To: <200908260002.03066.dl9pf@gmx.de> MIME-Version: 1.0 Content-Disposition: inline Message-Id: <200908260137.48781.dl9pf@gmx.de> X-Y-GMX-Trusted: 0 X-FuHaFi: 0.6 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 I read the comment above, but before replacing it in user-mode (if possible), we should fix it ;) . Best, Jan-Simon 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 */ \