diff options
author | Amit Choudhary <amit2030@gmail.com> | 2007-05-08 00:26:13 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-08 11:15:02 -0700 |
commit | d9a2f4a4945ebff54c9a011e4dc6e92d899ae26d (patch) | |
tree | f2a6b0ef82232251701363f1f3da2d51d6f09c0f | |
parent | fd463870dc89cac0f590ea007e3a5210103b1b04 (diff) | |
download | op-kernel-dev-d9a2f4a4945ebff54c9a011e4dc6e92d899ae26d.zip op-kernel-dev-d9a2f4a4945ebff54c9a011e4dc6e92d899ae26d.tar.gz |
drivers/char/synclink.c: check kmalloc() return value
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>
-rw-r--r-- | drivers/char/synclink.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/char/synclink.c b/drivers/char/synclink.c index ce4db6f..f02a079 100644 --- a/drivers/char/synclink.c +++ b/drivers/char/synclink.c @@ -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; |