From: Devendra Naga Date: Tue, 23 Oct 2012 22:04:32 +0000 (-0400) Subject: staging: slicoss: return -ENOMEM if kzalloc fail X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=0608882d01671983be20097e3ffd6be20c9a7724;p=linux-beck.git staging: slicoss: return -ENOMEM if kzalloc fail this takes up the error path cleanup, fixes a crash too due to null deref Signed-off-by: Devendra Naga Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c index 945428084914..f6af3fe46c5e 100644 --- a/drivers/staging/slicoss/slicoss.c +++ b/drivers/staging/slicoss/slicoss.c @@ -3667,6 +3667,8 @@ static u32 slic_card_locate(struct adapter *adapter) if (!physcard) { /* no structure allocated for this physical card yet */ physcard = kzalloc(sizeof(struct physcard), GFP_ATOMIC); + if (!physcard) + return -ENOMEM; physcard->next = slic_global.phys_card; slic_global.phys_card = physcard;