All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: dgnc: check if kzalloc fails in dgnc_tty_init()
@ 2015-04-07 10:26 Giedrius Statkevičius
  2015-04-07 10:41 ` Sudip Mukherjee
  2015-04-07 12:40 ` [PATCH v2] " Giedrius Statkevičius
  0 siblings, 2 replies; 27+ messages in thread
From: Giedrius Statkevičius @ 2015-04-07 10:26 UTC (permalink / raw)
  To: lidza.louina, markh
  Cc: gregkh, driverdev-devel, devel, linux-kernel, Giedrius Statkevičius

kzalloc() could fail so add a check and return -ENOMEM if it does that gets
propogated to the pci layer

Signed-off-by: Giedrius Statkevičius <giedrius.statkevicius@gmail.com>
---
 drivers/staging/dgnc/dgnc_tty.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/staging/dgnc/dgnc_tty.c b/drivers/staging/dgnc/dgnc_tty.c
index 61d5a8e..23337da 100644
--- a/drivers/staging/dgnc/dgnc_tty.c
+++ b/drivers/staging/dgnc/dgnc_tty.c
@@ -311,6 +311,8 @@ int dgnc_tty_init(struct dgnc_board *brd)
 			 * interrupt context, and there are no locks held.
 			 */
 			brd->channels[i] = kzalloc(sizeof(*brd->channels[i]), GFP_KERNEL);
+			if (!brd->channels[i])
+				return -ENOMEM;
 		}
 	}
 
-- 
2.3.5


^ permalink raw reply related	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2015-04-10  0:37 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-07 10:26 [PATCH] staging: dgnc: check if kzalloc fails in dgnc_tty_init() Giedrius Statkevičius
2015-04-07 10:41 ` Sudip Mukherjee
2015-04-07 11:53   ` Giedrius Statkevičius
2015-04-07 12:40 ` [PATCH v2] " Giedrius Statkevičius
2015-04-07 13:01   ` Dan Carpenter
2015-04-07 13:25     ` Giedrius Statkevičius
2015-04-07 14:11   ` [PATCH v3] " Giedrius Statkevičius
2015-04-07 14:24     ` Sudip Mukherjee
2015-04-07 14:37       ` Giedrius Statkevičius
2015-04-07 14:54         ` Dan Carpenter
2015-04-07 14:48     ` Dan Carpenter
2015-04-07 15:35       ` Giedrius Statkevičius
2015-04-07 15:46         ` Dan Carpenter
2015-04-07 15:46           ` Dan Carpenter
2015-04-07 16:11     ` [PATCH v4 1/3] staging: dgnc: clean up allocation of ->channels[i] Giedrius Statkevičius
2015-04-07 16:11       ` Giedrius Statkevičius
2015-04-09 23:42       ` [PATCH v5 " Giedrius Statkevičius
2015-04-09 23:42         ` Giedrius Statkevičius
2015-04-09 23:42       ` [PATCH v5 2/3] staging: dgnc: don't forget to check if ->channels[i] is NULL in dgnc_tty_uninit() Giedrius Statkevičius
2015-04-09 23:42         ` Giedrius Statkevičius
2015-04-09 23:42       ` [PATCH v5 3/3] staging: dgnc: remove redundant !ch checks Giedrius Statkevičius
2015-04-09 23:42         ` Giedrius Statkevičius
2015-04-07 16:11     ` [PATCH v4 2/3] staging: dgnc: don't forget to check if ->channels[i] is NULL in dgnc_tty_uninit() Giedrius Statkevičius
2015-04-07 16:11       ` Giedrius Statkevičius
2015-04-07 16:11     ` [PATCH v4 3/3] staging: dgnc: remove redundant !ch checks Giedrius Statkevičius
2015-04-07 16:11       ` Giedrius Statkevičius
2015-04-10  0:37       ` Dan Carpenter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.