mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Matteo Semenzato <mattew8898@gmail.com>
To: gregkh@linuxfoundation.org, lidza.louina@gmail.com, markh@compro.net
Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
	Matteo Semenzato <mattew8898@gmail.com>
Subject: [PATCH] Staging: dgnc: check kzalloc result
Date: Sun,  8 Mar 2015 17:54:07 +0100	[thread overview]
Message-ID: <1425833647-21686-1-git-send-email-mattew8898@gmail.com> (raw)

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


             reply	other threads:[~2015-03-08 16:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-08 16:54 Matteo Semenzato [this message]
2015-03-09 11:24 ` Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1425833647-21686-1-git-send-email-mattew8898@gmail.com \
    --to=mattew8898@gmail.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=lidza.louina@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=markh@compro.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®