[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190302204006.9953-1-pakki001@umn.edu>
Date: Sat, 2 Mar 2019 14:40:04 -0600
From: Aditya Pakki <pakki001@....edu>
To: pakki001@....edu
Cc: kjlu@....edu, Bartlomiej Zolnierkiewicz <b.zolnierkie@...sung.com>,
linux-omap@...r.kernel.org, linux-fbdev@...r.kernel.org,
dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org
Subject: [PATCH] omapfb: Fix potential NULL pointer dereference in kmalloc
Memory allocated, using kmalloc, for new_compat may fail. This patch
checks for such an error and prevents potential NULL pointer
dereference.
Signed-off-by: Aditya Pakki <pakki001@....edu>
---
drivers/video/fbdev/omap2/omapfb/dss/omapdss-boot-init.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/video/fbdev/omap2/omapfb/dss/omapdss-boot-init.c b/drivers/video/fbdev/omap2/omapfb/dss/omapdss-boot-init.c
index 136d30484d02..0592c436b2da 100644
--- a/drivers/video/fbdev/omap2/omapfb/dss/omapdss-boot-init.c
+++ b/drivers/video/fbdev/omap2/omapfb/dss/omapdss-boot-init.c
@@ -111,6 +111,8 @@ static void __init omapdss_omapify_node(struct device_node *node)
new_len = prop->length + strlen(prefix) * num_strs;
new_compat = kmalloc(new_len, GFP_KERNEL);
+ if (!new_compat)
+ return;
omapdss_prefix_strcpy(new_compat, new_len, prop->value, prop->length);
--
2.17.1
Powered by blists - more mailing lists