lkml.org 
[lkml]   [2015]   [Mar]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] Staging: dgnc: check kzalloc result
Date
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


\
 
 \ /
  Last update: 2015-03-08 18:01    [W:0.026 / U:1.164 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site