* [v1] video:fbdev:cobalt_lcdfb:- Handle return NULL error from devm_ioremap
@ 2016-12-13 8:20 Arvind Yadav
2016-12-14 2:23 ` Yuasa Yoichi
0 siblings, 1 reply; 3+ messages in thread
From: Arvind Yadav @ 2016-12-13 8:20 UTC (permalink / raw)
To: tomi.valkeinen; +Cc: ralf, paul.burton, linux-fbdev, linux-kernel
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [v1] video:fbdev:cobalt_lcdfb:- Handle return NULL error from devm_ioremap
2016-12-13 8:20 [v1] video:fbdev:cobalt_lcdfb:- Handle return NULL error from devm_ioremap Arvind Yadav
@ 2016-12-14 2:23 ` Yuasa Yoichi
[not found] ` <CGME20170104124152epcas1p2f74f40d8d9d361c98a1bcd463a8fe1cd@epcas1p2.samsung.com>
0 siblings, 1 reply; 3+ messages in thread
From: Yuasa Yoichi @ 2016-12-14 2:23 UTC (permalink / raw)
To: Arvind Yadav; +Cc: tomi.valkeinen, ralf, paul.burton, linux-fbdev, linux-kernel
Hi Arvind,
Thank you for fixing it.
Acked-by: Yoichi Yuasa <yuasa@linux-mips.org>
2016-12-13 17:20 GMT+09:00 Arvind Yadav <arvind.yadav.cs@gmail.com>:
> 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
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [v1] video:fbdev:cobalt_lcdfb:- Handle return NULL error from devm_ioremap
[not found] ` <CGME20170104124152epcas1p2f74f40d8d9d361c98a1bcd463a8fe1cd@epcas1p2.samsung.com>
@ 2017-01-04 12:41 ` Bartlomiej Zolnierkiewicz
0 siblings, 0 replies; 3+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2017-01-04 12:41 UTC (permalink / raw)
To: Yuasa Yoichi, Arvind Yadav
Cc: tomi.valkeinen, ralf, paul.burton, linux-fbdev, linux-kernel
Hi,
On Wednesday, December 14, 2016 11:23:07 AM Yuasa Yoichi wrote:
> Hi Arvind,
>
> Thank you for fixing it.
>
> Acked-by: Yoichi Yuasa <yuasa@linux-mips.org>
>
> 2016-12-13 17:20 GMT+09:00 Arvind Yadav <arvind.yadav.cs@gmail.com>:
> > 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>
Applied & queued for v4.10.
Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-01-04 12:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-13 8:20 [v1] video:fbdev:cobalt_lcdfb:- Handle return NULL error from devm_ioremap Arvind Yadav
2016-12-14 2:23 ` Yuasa Yoichi
[not found] ` <CGME20170104124152epcas1p2f74f40d8d9d361c98a1bcd463a8fe1cd@epcas1p2.samsung.com>
2017-01-04 12:41 ` Bartlomiej Zolnierkiewicz
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).