From patchwork Tue Dec 16 04:17:48 2008 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Breeds X-Patchwork-Id: 14155 X-Patchwork-Delegate: paulus@samba.org Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from ozlabs.org (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id D40E24754F for ; Tue, 16 Dec 2008 15:18:06 +1100 (EST) X-Original-To: linuxppc-dev@ozlabs.org Delivered-To: linuxppc-dev@ozlabs.org Received: by ozlabs.org (Postfix, from userid 1026) id 257DEDDF25; Tue, 16 Dec 2008 15:17:48 +1100 (EST) Date: Tue, 16 Dec 2008 15:17:48 +1100 From: Tony Breeds To: Paul Mackerras , Benjamin Herrenschmidt , Manish Ahuja Subject: [PATCH] Protect against NULL pointer deref in phyp-dump code. Message-ID: <20081216041748.GB14890@ozlabs.org> Mail-Followup-To: Paul Mackerras , Benjamin Herrenschmidt , Manish Ahuja , LinuxPPC-dev MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) Cc: LinuxPPC-dev X-BeenThere: linuxppc-dev@ozlabs.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.org print_dump_header() will be called at least once with a NULL pointer in a normal boot sequence. if DEBUG is defined then we will get a deref, add a quick fix to exit early in the NULL pointer case. Signed-off-by: Tony Breeds Acked-by: Manish Ahuja --- arch/powerpc/platforms/pseries/phyp_dump.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/arch/powerpc/platforms/pseries/phyp_dump.c b/arch/powerpc/platforms/pseries/phyp_dump.c index edbc012..16e659a 100644 --- a/arch/powerpc/platforms/pseries/phyp_dump.c +++ b/arch/powerpc/platforms/pseries/phyp_dump.c @@ -130,6 +130,9 @@ static unsigned long init_dump_header(struct phyp_dump_header *ph) static void print_dump_header(const struct phyp_dump_header *ph) { #ifdef DEBUG + if (ph == NULL) + return; + printk(KERN_INFO "dump header:\n"); /* setup some ph->sections required */ printk(KERN_INFO "version = %d\n", ph->version);