diff options
author | Kangjie Lu <kjlu@umn.edu> | 2019-04-01 17:46:58 +0200 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> | 2019-04-01 17:46:58 +0200 |
commit | 1d84353d205a953e2381044953b7fa31c8c9702d (patch) | |
tree | c92edc27cb175cd693efc7a062dae8f903bfd9bc /drivers/video/fbdev/imsttfb.c | |
parent | ec7f6aad57ad29e4e66cc2e18e1e1599ddb02542 (diff) | |
download | linux-1d84353d205a953e2381044953b7fa31c8c9702d.tar.gz linux-1d84353d205a953e2381044953b7fa31c8c9702d.tar.bz2 linux-1d84353d205a953e2381044953b7fa31c8c9702d.zip |
video: imsttfb: fix potential NULL pointer dereferences
In case ioremap fails, the fix releases resources and returns
-ENOMEM to avoid NULL pointer dereferences.
Signed-off-by: Kangjie Lu <kjlu@umn.edu>
Cc: Aditya Pakki <pakki001@umn.edu>
Cc: Finn Thain <fthain@telegraphics.com.au>
Cc: Rob Herring <robh@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[b.zolnierkie: minor patch summary fixup]
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Diffstat (limited to 'drivers/video/fbdev/imsttfb.c')
-rw-r--r-- | drivers/video/fbdev/imsttfb.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/video/fbdev/imsttfb.c b/drivers/video/fbdev/imsttfb.c index 4b9615e4ce74..35bba3c2036d 100644 --- a/drivers/video/fbdev/imsttfb.c +++ b/drivers/video/fbdev/imsttfb.c @@ -1515,6 +1515,11 @@ static int imsttfb_probe(struct pci_dev *pdev, const struct pci_device_id *ent) info->fix.smem_start = addr; info->screen_base = (__u8 *)ioremap(addr, par->ramdac == IBM ? 0x400000 : 0x800000); + if (!info->screen_base) { + release_mem_region(addr, size); + framebuffer_release(info); + return -ENOMEM; + } info->fix.mmio_start = addr + 0x800000; par->dc_regs = ioremap(addr + 0x800000, 0x1000); par->cmap_regs_phys = addr + 0x840000; |