Browse Source

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 <devendra.aaru@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Devendra Naga 12 years ago
parent
commit
0608882d01
1 changed files with 2 additions and 0 deletions
  1. 2 0
      drivers/staging/slicoss/slicoss.c

+ 2 - 0
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;