From: Zhouyi Zhou Date: Thu, 10 Feb 2022 06:58:24 +0000 (+0800) Subject: video: fbdev: fbmem: fix pointer reference to null device field X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=d6cd978f7e6b6f6895f8d0c4ce6e5d2c8e979afe;p=linux.git video: fbdev: fbmem: fix pointer reference to null device field In function do_remove_conflicting_framebuffers, if device is NULL, there will be null pointer reference. The patch add a check to the if expression. Signed-off-by: Zhouyi Zhou Acked-by: Paul Menzel Signed-off-by: Helge Deller Link: https://patchwork.freedesktop.org/patch/msgid/20220210065824.368355-1-zhouzhouyi@gmail.com --- diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c index bdd00d381bbc4..1cfb2bd090b67 100644 --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -1579,7 +1579,7 @@ static void do_remove_conflicting_framebuffers(struct apertures_struct *a, * If it's not a platform device, at least print a warning. A * fix would add code to remove the device from the system. */ - if (dev_is_platform(device)) { + if (device && dev_is_platform(device)) { registered_fb[i]->forced_out = true; platform_device_unregister(to_platform_device(device)); } else {