[PATCH] omapfb: Fix potential NULL pointer dereference in kmalloc

Subsystems: framebuffer layer, omap display subsystem and framebuffer support (dss2), the rest

STALE2715d

2 messages, 2 authors, 2019-04-01 · open the first message on its own page

[PATCH] omapfb: Fix potential NULL pointer dereference in kmalloc

From: Aditya Pakki <hidden>
Date: 2019-03-02 20:40:19

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 <redacted>
---
 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

Re: [PATCH] omapfb: Fix potential NULL pointer dereference in kmalloc

From: Bartlomiej Zolnierkiewicz <hidden>
Date: 2019-04-01 13:01:53

On 03/02/2019 09:40 PM, Aditya Pakki wrote:
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 <redacted>
Patch queued for v5.2, thanks.

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help