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>
This commit is contained in:
Родитель
fd463870dc
Коммит
d9a2f4a494
|
@ -4010,9 +4010,14 @@ static int mgsl_alloc_intermediate_txbuffer_memory(struct mgsl_struct *info)
|
||||||
for ( i=0; i<info->num_tx_holding_buffers; ++i) {
|
for ( i=0; i<info->num_tx_holding_buffers; ++i) {
|
||||||
info->tx_holding_buffers[i].buffer =
|
info->tx_holding_buffers[i].buffer =
|
||||||
kmalloc(info->max_frame_size, GFP_KERNEL);
|
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 -ENOMEM;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче