Commit a417ea5b9d22dc5733f6fac5cee72735cb7f8d99

Authored by Arvind Yadav
Committed by Greg Kroah-Hartman
1 parent ddc0ec3be8

video: fbdev: cobalt_lcdfb: Handle return NULL error from devm_ioremap

[ Upstream commit 4dcd19bfabaee8f9f4bcf203afba09b98ccbaf76 ]

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>
Acked-by: Yoichi Yuasa <yuasa@linux-mips.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Showing 1 changed file with 5 additions and 0 deletions Side-by-side Diff

drivers/video/fbdev/cobalt_lcdfb.c
... ... @@ -308,6 +308,11 @@
308 308 info->screen_size = resource_size(res);
309 309 info->screen_base = devm_ioremap(&dev->dev, res->start,
310 310 info->screen_size);
  311 + if (!info->screen_base) {
  312 + framebuffer_release(info);
  313 + return -ENOMEM;
  314 + }
  315 +
311 316 info->fbops = &cobalt_lcd_fbops;
312 317 info->fix = cobalt_lcdfb_fix;
313 318 info->fix.smem_start = res->start;