Message ID | 20190314073319.23209-1-kjlu@umn.edu (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | video: fbdev: fix potential NULL pointer dereferences | expand |
On 03/14/2019 08:33 AM, Kangjie Lu wrote: > In case ioremap fails, the fix releases resources and returns > -ENOMEM to avoid NULL pointer dereferences. > > Signed-off-by: Kangjie Lu <kjlu@umn.edu> Patch queued for v5.2 with minor change in the patch summary ("video: imsttfb: fix potential NULL pointer dereference"), thanks. Best regards, -- Bartlomiej Zolnierkiewicz Samsung R&D Institute Poland Samsung Electronics
diff --git a/drivers/video/fbdev/imsttfb.c b/drivers/video/fbdev/imsttfb.c index 5d9670daf60e..2e321d73b3a5 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;
In case ioremap fails, the fix releases resources and returns -ENOMEM to avoid NULL pointer dereferences. Signed-off-by: Kangjie Lu <kjlu@umn.edu> --- drivers/video/fbdev/imsttfb.c | 5 +++++ 1 file changed, 5 insertions(+)