From: Tony Breeds Date: Mon, 15 Dec 2008 18:17:48 +0000 (+0000) Subject: powerpc: Protect against NULL pointer deref in phyp-dump code X-Git-Tag: v2.6.29-rc1~574^2~43 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=7a2eab0d4e656341cc0f6481d722d410f0414f0b;p=linux-2.6-omap-h63xx.git powerpc: Protect against NULL pointer deref in phyp-dump code 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 dereference the pointer and crash. Add a quick fix to exit early in the NULL pointer case. Signed-off-by: Tony Breeds Acked-by: Manish Ahuja Signed-off-by: Paul Mackerras --- diff --git a/arch/powerpc/platforms/pseries/phyp_dump.c b/arch/powerpc/platforms/pseries/phyp_dump.c index edbc012c2eb..16e659a7144 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);