Skip to content

Commit

Permalink
powerpc: Protect against NULL pointer deref in phyp-dump code
Browse files Browse the repository at this point in the history
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 <tony@bakeyournoodle.com>
Acked-by: Manish Ahuja <mahujam@gmail.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
  • Loading branch information
Tony Breeds authored and Paul Mackerras committed Dec 21, 2008
1 parent 8168b54 commit 7a2eab0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions arch/powerpc/platforms/pseries/phyp_dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 7a2eab0

Please sign in to comment.