Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

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>

authored by

Arvind Yadav and committed by
Bartlomiej Zolnierkiewicz
4dcd19bf 04f6152d

+5
+5
drivers/video/fbdev/cobalt_lcdfb.c
··· 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;