diff mbox series

[-next] video: fbdev: Fix potential NULL pointer dereference

Message ID 20190130101625.20048-1-yuehaibing@huawei.com (mailing list archive)
State New, archived
Headers show
Series [-next] video: fbdev: Fix potential NULL pointer dereference | expand

Commit Message

Yue Haibing Jan. 30, 2019, 10:16 a.m. UTC
There is a potential NULL pointer dereference in case
fb_create_modedb() fails and returns NULL.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 drivers/video/fbdev/core/fbmon.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Bartlomiej Zolnierkiewicz Feb. 8, 2019, 6:05 p.m. UTC | #1
On 01/30/2019 11:16 AM, YueHaibing wrote:
> There is a potential NULL pointer dereference in case
> fb_create_modedb() fails and returns NULL.
> 
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>

Patch queued for v5.1, thanks.

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics
diff mbox series

Patch

diff --git a/drivers/video/fbdev/core/fbmon.c b/drivers/video/fbdev/core/fbmon.c
index dd31289..3558a70 100644
--- a/drivers/video/fbdev/core/fbmon.c
+++ b/drivers/video/fbdev/core/fbmon.c
@@ -978,6 +978,8 @@  void fb_edid_to_monspecs(unsigned char *edid, struct fb_monspecs *specs)
 	get_monspecs(edid, specs);
 
 	specs->modedb = fb_create_modedb(edid, &specs->modedb_len, specs);
+	if (!specs->modedb)
+		return;
 
 	/*
 	 * Workaround for buggy EDIDs that sets that the first