From: Arvind Yadav <arvind.yadav.cs@gmail.com>
To: tomi.valkeinen@ti.com
Cc: ralf@linux-mips.org, paul.burton@imgtec.com,
linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [v1] video:fbdev:cobalt_lcdfb:- Handle return NULL error from devm_ioremap
Date: Tue, 13 Dec 2016 08:32:52 +0000 [thread overview]
Message-ID: <1481617252-8298-1-git-send-email-arvind.yadav.cs@gmail.com> (raw)
Here, If devm_ioremap will fail. It will return NULL.
Kernel can run into a NULL-pointer dereference.
This error check will avoid NULL pointer dereference.
Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
drivers/video/fbdev/cobalt_lcdfb.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/video/fbdev/cobalt_lcdfb.c b/drivers/video/fbdev/cobalt_lcdfb.c
index 2d3b691..038ac69 100644
--- a/drivers/video/fbdev/cobalt_lcdfb.c
+++ b/drivers/video/fbdev/cobalt_lcdfb.c
@@ -308,6 +308,11 @@ static int cobalt_lcdfb_probe(struct platform_device *dev)
info->screen_size = resource_size(res);
info->screen_base = devm_ioremap(&dev->dev, res->start,
info->screen_size);
+ if (!info->screen_base) {
+ framebuffer_release(info);
+ return -ENOMEM;
+ }
+
info->fbops = &cobalt_lcd_fbops;
info->fix = cobalt_lcdfb_fix;
info->fix.smem_start = res->start;
--
2.7.4
next reply other threads:[~2016-12-13 8:32 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-13 8:32 Arvind Yadav [this message]
2016-12-14 2:23 ` [v1] video:fbdev:cobalt_lcdfb:- Handle return NULL error from devm_ioremap Yuasa Yoichi
[not found] ` <CGME20170104124152epcas1p2f74f40d8d9d361c98a1bcd463a8fe1cd@epcas1p2.samsung.com>
2017-01-04 12:41 ` Bartlomiej Zolnierkiewicz
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=1481617252-8298-1-git-send-email-arvind.yadav.cs@gmail.com \
--to=arvind.yadav.cs@gmail.com \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=paul.burton@imgtec.com \
--cc=ralf@linux-mips.org \
--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).