From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Cc: LinuxPPC-dev List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 --- 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); -- 1.6.0.4 Yours Tony linux.conf.au http://www.marchsouth.org/ Jan 19 - 24 2009 The Australian Linux Technical Conference!