[PATCH] Protect against NULL pointer deref in phyp-dump code.

Manish Ahuja ahuja at austin.ibm.com
Wed Dec 17 09:18:23 EST 2008


Acked-by: Manish Ahuja <mahujam at gmail.com>


Tony Breeds wrote:
> 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 <tony at bakeyournoodle.com>
> ---
>  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);


-- 

--
Manish Ahuja
Linux RAS Engineer.
IBM Linux Technology Center
mahuja at us.ibm.com
512-838-1928, t/l 678-1928.




More information about the Linuxppc-dev mailing list