From: Peter Huewe <PeterHuewe@gmx.de>
To: "Greg Kroah-Hartman" <gregkh@suse.de>
Cc: Andre Haupt <andre@bitwigglers.org>,
"Kevin A. Granade" <kevin.granade@gmail.com>,
linux-kernel@vger.kernel.org, devel@driverdev.osuosl.org,
sjakub@gmail.com
Subject: [PATCH] staging/asus_oled: Add NULL test for kmalloc
Date: Thu, 7 Jan 2010 20:03:51 +0100 [thread overview]
Message-ID: <201001072003.51722.PeterHuewe@gmx.de> (raw)
From: Peter Huewe <peterhuewe@gmx.de>
Date: Thu, 7 Jan 2010 19:57:36 +0100
This patch adds a NULL test to check wether kmalloc was successful or
not.
Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
---
Patch against Linux-next of Do 7. Jan 19:59:41 CET 2010
drivers/staging/asus_oled/asus_oled.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/drivers/staging/asus_oled/asus_oled.c b/drivers/staging/asus_oled/asus_oled.c
index 0c1fb0d..c597fb2 100644
--- a/drivers/staging/asus_oled/asus_oled.c
+++ b/drivers/staging/asus_oled/asus_oled.c
@@ -430,6 +430,11 @@ static ssize_t odev_set_picture(struct asus_oled_dev *odev,
kfree(odev->buf);
odev->buf = kmalloc(odev->buf_size, GFP_KERNEL);
+ if (odev->buf == NULL) {
+ odev->buf_size = 0;
+ printk(ASUS_OLED_ERROR "Out of memory!\n");
+ return -ENOMEM;
+ }
memset(odev->buf, 0xff, odev->buf_size);
--
1.6.4.4
reply other threads:[~2010-01-07 19:03 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=201001072003.51722.PeterHuewe@gmx.de \
--to=peterhuewe@gmx.de \
--cc=andre@bitwigglers.org \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@suse.de \
--cc=kevin.granade@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=sjakub@gmail.com \
/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
Powered by JetHome