From: David S. Miller Date: Fri, 1 Dec 2006 01:11:26 +0000 (-0800) Subject: [SPARC]: Check kzalloc() return value in SUN4D irq/iommu init. X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=d4accd60d23f3c8a576fd08b727f88096f42d445;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git [SPARC]: Check kzalloc() return value in SUN4D irq/iommu init. Signed-off-by: David S. Miller --- diff --git a/arch/sparc/kernel/sun4d_irq.c b/arch/sparc/kernel/sun4d_irq.c index b8bd53ab29c5..cf1b8baa57ea 100644 --- a/arch/sparc/kernel/sun4d_irq.c +++ b/arch/sparc/kernel/sun4d_irq.c @@ -546,6 +546,10 @@ void __init sun4d_init_sbi_irq(void) for_each_sbus(sbus) nsbi++; sbus_actions = kzalloc (nsbi * 8 * 4 * sizeof(struct sbus_action), GFP_ATOMIC); + if (!sbus_actions) { + prom_printf("SUN4D: Cannot allocate sbus_actions, halting.\n"); + prom_halt(); + } for_each_sbus(sbus) { #ifdef CONFIG_SMP extern unsigned char boot_cpu_id; diff --git a/arch/sparc/mm/io-unit.c b/arch/sparc/mm/io-unit.c index 007062022967..4ccda77d08d6 100644 --- a/arch/sparc/mm/io-unit.c +++ b/arch/sparc/mm/io-unit.c @@ -22,6 +22,7 @@ #include #include #include +#include /* #define IOUNIT_DEBUG */ #ifdef IOUNIT_DEBUG @@ -42,6 +43,10 @@ iounit_init(int sbi_node, int io_node, struct sbus_bus *sbus) struct resource r; iounit = kzalloc(sizeof(struct iounit_struct), GFP_ATOMIC); + if (!iounit) { + prom_printf("SUN4D: Cannot alloc iounit, halting.\n"); + prom_halt(); + } iounit->limit[0] = IOUNIT_BMAP1_START; iounit->limit[1] = IOUNIT_BMAP2_START;