Skip to content

Commit

Permalink
drivers/char/synclink.c: check kmalloc() return value
Browse files Browse the repository at this point in the history
Signed-off-by: Amit Choudhary <amit2030@gmail.com>
Cc: Paul Fulghum <paulkf@microgate.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Amit Choudhary authored and Linus Torvalds committed May 8, 2007
1 parent fd46387 commit d9a2f4a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion drivers/char/synclink.c
Original file line number Diff line number Diff line change
Expand Up @@ -4010,8 +4010,13 @@ static int mgsl_alloc_intermediate_txbuffer_memory(struct mgsl_struct *info)
for ( i=0; i<info->num_tx_holding_buffers; ++i) {
info->tx_holding_buffers[i].buffer =
kmalloc(info->max_frame_size, GFP_KERNEL);
if ( info->tx_holding_buffers[i].buffer == NULL )
if (info->tx_holding_buffers[i].buffer == NULL) {
for (--i; i >= 0; i--) {
kfree(info->tx_holding_buffers[i].buffer);
info->tx_holding_buffers[i].buffer = NULL;
}
return -ENOMEM;
}
}

return 0;
Expand Down

0 comments on commit d9a2f4a

Please sign in to comment.