video: fbdev: stifb: handle NULL return value from ioremap_nocache
authorArvind Yadav <arvind.yadav.cs@gmail.com>
Mon, 30 Jan 2017 16:39:49 +0000 (17:39 +0100)
committerBartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Mon, 30 Jan 2017 16:39:49 +0000 (17:39 +0100)
Add missing error check for ioremap_nocache() failure
(prevents NULL pointer dereference on error).

Cc: "James E.J. Bottomley" <jejb@parisc-linux.org>
Cc: Helge Deller <deller@gmx.de>
Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
[b.zolnierkie: minor fixes]
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
drivers/video/fbdev/stifb.c

index accfef71e984763ce83a380337199d0915b5c649..6ded5c1989985c5889a69383e767d91670799f09 100644 (file)
@@ -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;