projects
/
GitHub
/
LineageOS
/
android_kernel_motorola_exynos9610.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
c424d46
)
Staging: asus_oled: Add NULL test for kmalloc
author
Peter Huewe
<peterhuewe@gmx.de>
Thu, 7 Jan 2010 18:57:36 +0000
(19:57 +0100)
committer
Greg Kroah-Hartman
<gregkh@suse.de>
Thu, 4 Mar 2010 00:42:40 +0000
(16:42 -0800)
This patch adds a NULL test to check wether kmalloc was successful or
not.
Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/asus_oled/asus_oled.c
patch
|
blob
|
blame
|
history
diff --git
a/drivers/staging/asus_oled/asus_oled.c
b/drivers/staging/asus_oled/asus_oled.c
index 0c1fb0d618a5ab190d8bf3139ffcd52c7848d548..c597fb27bd533e5c965934fc0deb85692444ea69 100644
(file)
--- 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);