From: Arvind Yadav Date: Mon, 30 Jan 2017 16:39:49 +0000 (+0100) Subject: video: fbdev: stifb: handle NULL return value from ioremap_nocache X-Git-Tag: v4.14-rc1~1413^2~16 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=74a2b96e61d78051c70c24ad4499e0c8dcd1a0f1;p=platform%2Fkernel%2Flinux-rpi.git video: fbdev: stifb: handle NULL return value from ioremap_nocache Add missing error check for ioremap_nocache() failure (prevents NULL pointer dereference on error). Cc: "James E.J. Bottomley" Cc: Helge Deller Signed-off-by: Arvind Yadav [b.zolnierkie: minor fixes] Signed-off-by: Bartlomiej Zolnierkiewicz --- diff --git a/drivers/video/fbdev/stifb.c b/drivers/video/fbdev/stifb.c index accfef7..6ded5c1 100644 --- a/drivers/video/fbdev/stifb.c +++ b/drivers/video/fbdev/stifb.c @@ -1294,6 +1294,10 @@ static int __init stifb_init_fb(struct sti_struct *sti, int bpp_pref) strcpy(fix->id, "stifb"); info->fbops = &stifb_ops; info->screen_base = ioremap_nocache(REGION_BASE(fb,1), fix->smem_len); + if (!info->screen_base) { + printk(KERN_ERR "stifb: failed to map memory\n"); + goto out_err0; + } info->screen_size = fix->smem_len; info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_COPYAREA; info->pseudo_palette = &fb->pseudo_palette;