s390: kmalloc failure ignored in smp_get_save_area()
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 11 lines · Roel Kluin
Prevent NULL dereference if
kmalloc()fails.Signed-off-by Roel Kluin <[email protected]>---
Found with sed: http://kernelnewbies.org/roelkluinarch/s390/kernel/smp.c +0
-0
arch/s390/kernel/smp.c static void __init smp_get_save_area(unsigned int cpu, unsigned int phy_cpu) · line 251
Quoted 5 lines
arch/s390/kernel/smp.c +2
-0@@ -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 ;)