On Wed, 09 Sep 2009 01:40:10 +0200 Roel Kluin <roel.kluin@xxxxxxxxx> 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/alpha/kernel/module.c b/arch/alpha/kernel/module.c > index ebc3c89..8ceec20 100644 > --- a/arch/alpha/kernel/module.c > +++ b/arch/alpha/kernel/module.c > @@ -73,6 +73,8 @@ process_reloc_for_got(Elf64_Rela *rela, > } > > g = kmalloc (sizeof (*g), GFP_KERNEL); > + if (g == NULL) > + return; > g->next = chains[r_sym].next; > g->r_addend = r_addend; > g->got_offset = *poffset; I don't know if that's an improvement. afacit the kernel will now blunder along and do something wrong. An oops might well be preferable behaviour. IOW, we should handle this failure properly - back out, clean everything up, return -ENOMEM to userspace -- To unsubscribe from this list: send the line "unsubscribe linux-alpha" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html