Re: [PATCH] s390: kmalloc failure ignored in smp_get_save_area()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Sep 09, 2009 at 05:14:22PM +0200, Roel Kluin wrote:
> Prevent NULL dereference if kmalloc() fails.
> 
> Signed-off-by: Roel Kluin <roel.kluin@xxxxxxxxx>
> ---
> Found with sed: http://kernelnewbies.org/roelkluin
> 
> diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
> index be2cae0..dfeac28 100644
> --- a/arch/s390/kernel/smp.c
> +++ b/arch/s390/kernel/smp.c
> @@ -247,6 +247,8 @@ static void __init smp_get_save_area(unsigned int cpu, unsigned int phy_cpu)
>  		return;
>  	}
>  	zfcpdump_save_areas[cpu] = kmalloc(sizeof(union save_area), GFP_KERNEL);
> +	if (zfcpdump_save_areas[cpu] == NULL)
> +		return;

If that allocation would fail that early in the boot process the only
sane answer would be panic().
But if that allocation would fail the system is useless anyway so it
really doesn't matter if we have a NULL pointer dereference just a
few lines below. The result would be the same ;)
--
To unsubscribe from this list: send the line "unsubscribe linux-s390" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Kernel Development]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Info]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Linux Media]     [Device Mapper]

  Powered by Linux