* [PATCH] drivers/char/synclink.c: check kmalloc() return value.
@ 2007-03-09 7:22 Amit Choudhary
0 siblings, 0 replies; only message in thread
From: Amit Choudhary @ 2007-03-09 7:22 UTC (permalink / raw)
To: Linux Kernel, akpm; +Cc: netdev
Description: Check the return value of kmalloc() in function mgsl_alloc_intermediate_txbuffer_memory(), in file drivers/char/synclink.c.
Signed-off-by: Amit Choudhary <amit2030@gmail.com>
diff --git a/drivers/char/synclink.c b/drivers/char/synclink.c
index 06784ad..24f99bc 100644
--- a/drivers/char/synclink.c
+++ b/drivers/char/synclink.c
@@ -4012,8 +4012,13 @@ static int mgsl_alloc_intermediate_txbuf
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;
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2007-03-09 7:22 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-09 7:22 [PATCH] drivers/char/synclink.c: check kmalloc() return value Amit Choudhary
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).