mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] omapfb: Fix potential NULL pointer dereference in kmalloc
@ 2019-03-02 20:40 ` Aditya Pakki
  2019-04-01 13:01   ` Bartlomiej Zolnierkiewicz
  0 siblings, 1 reply; 2+ messages in thread
From: Aditya Pakki @ 2019-03-02 20:40 UTC (permalink / raw)
  To: pakki001
  Cc: kjlu, Bartlomiej Zolnierkiewicz, linux-omap, linux-fbdev,
	dri-devel, linux-kernel

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@umn.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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] omapfb: Fix potential NULL pointer dereference in kmalloc
  2019-03-02 20:40 ` [PATCH] omapfb: Fix potential NULL pointer dereference in kmalloc Aditya Pakki
@ 2019-04-01 13:01   ` Bartlomiej Zolnierkiewicz
  0 siblings, 0 replies; 2+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2019-04-01 13:01 UTC (permalink / raw)
  To: Aditya Pakki; +Cc: kjlu, linux-omap, linux-fbdev, dri-devel, linux-kernel


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 <pakki001@umn.edu>

Patch queued for v5.2, thanks.

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-04-01 13:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20190302204019epcas2p39a9b9bc29383567d5442fcb3a7efaeed@epcas2p3.samsung.com>
2019-03-02 20:40 ` [PATCH] omapfb: Fix potential NULL pointer dereference in kmalloc Aditya Pakki
2019-04-01 13:01   ` Bartlomiej Zolnierkiewicz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®