From: Kiran Padwal <kiran.padwal@smartplayin.com>
To: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: Russell King <linux@arm.linux.org.uk>,
Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>,
linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Kiran Padwal <kiran.padwal21@gmail.com>,
Kiran Padwal <kiran.padwal@smartplayin.com>
Subject: [PATCH] video: ARM CLCD: Add missing error check for devm_kzalloc
Date: Wed, 11 Feb 2015 09:48:45 +0000 [thread overview]
Message-ID: <1423647406-858-1-git-send-email-kiran.padwal@smartplayin.com> (raw)
This patch add a missing check on the return value of devm_kzalloc,
which would cause a NULL pointer dereference in a OOM situation.
Signed-off-by: Kiran Padwal <kiran.padwal@smartplayin.com>
---
drivers/video/fbdev/amba-clcd.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/video/fbdev/amba-clcd.c b/drivers/video/fbdev/amba-clcd.c
index 32c0b6b..9362424 100644
--- a/drivers/video/fbdev/amba-clcd.c
+++ b/drivers/video/fbdev/amba-clcd.c
@@ -599,6 +599,9 @@ static int clcdfb_of_get_mode(struct device *dev, struct device_node *endpoint,
len = clcdfb_snprintf_mode(NULL, 0, mode);
name = devm_kzalloc(dev, len + 1, GFP_KERNEL);
+ if (!name)
+ return -ENOMEM;
+
clcdfb_snprintf_mode(name, len + 1, mode);
mode->name = name;
--
1.7.9.5
next reply other threads:[~2015-02-11 9:48 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-11 9:48 Kiran Padwal [this message]
2015-02-20 12:12 ` [PATCH] video: ARM CLCD: Add missing error check for devm_kzalloc Tomi Valkeinen
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=1423647406-858-1-git-send-email-kiran.padwal@smartplayin.com \
--to=kiran.padwal@smartplayin.com \
--cc=kiran.padwal21@gmail.com \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=plagnioj@jcrosoft.com \
--cc=tomi.valkeinen@ti.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;
as well as URLs for NNTP newsgroup(s).