Skip to content

Commit

Permalink
staging: slicoss: return -ENOMEM if kzalloc fail
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Devendra Naga authored and Greg Kroah-Hartman committed Oct 24, 2012
1 parent 7fc465b commit 0608882
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/staging/slicoss/slicoss.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 0608882

Please sign in to comment.