public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Staging: dgnc: check kzalloc result
@ 2015-03-08 16:54 Matteo Semenzato
  2015-03-09 11:24 ` Dan Carpenter
  0 siblings, 1 reply; 2+ messages in thread
From: Matteo Semenzato @ 2015-03-08 16:54 UTC (permalink / raw)
  To: gregkh, lidza.louina, markh; +Cc: devel, linux-kernel, Matteo Semenzato

From: Matteo Semenzato <mattew8898@gmail.com>

Return -ENOMEM if allocating brd->flipbuf fails.

Signed-off-by: Matteo Semenzato <mattew8898@gmail.com>
---
 drivers/staging/dgnc/dgnc_driver.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/staging/dgnc/dgnc_driver.c b/drivers/staging/dgnc/dgnc_driver.c
index f177d3a..711af02 100644
--- a/drivers/staging/dgnc/dgnc_driver.c
+++ b/drivers/staging/dgnc/dgnc_driver.c
@@ -622,6 +622,10 @@ static int dgnc_found_board(struct pci_dev *pdev, int id)
 	 * context, and there are no locks held.
 	 */
 	brd->flipbuf = kzalloc(MYFLIPLEN, GFP_KERNEL);
+	if (!brd->flipbuf) {
+		kfree(brd);
+		return -ENOMEM;
+	}
 
 	wake_up_interruptible(&brd->state_wait);
 
-- 
2.3.1


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

end of thread, other threads:[~2015-03-09 11:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-08 16:54 [PATCH] Staging: dgnc: check kzalloc result Matteo Semenzato
2015-03-09 11:24 ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox