Thread (3 messages) 3 messages, 3 authors, 2014-06-23

Re: [PATCH 1/1] video: omapdss: Fix potential null pointer dereference

From: Sachin Kamat <hidden>
Date: 2014-06-20 09:21:40

On Fri, May 30, 2014 at 3:56 PM, Sachin Kamat [off-list ref] wrote:
quoted hunk ↗ jump to hunk
kmalloc can return null. Add a check to avoid potential null
pointer dereference error when the pointer is accessed later.

Signed-off-by: Sachin Kamat <redacted>
---
 drivers/video/fbdev/omap2/dss/omapdss-boot-init.c |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/video/fbdev/omap2/dss/omapdss-boot-init.c b/drivers/video/fbdev/omap2/dss/omapdss-boot-init.c
index 99af9e88b2d8..2f0822ee3ff9 100644
--- a/drivers/video/fbdev/omap2/dss/omapdss-boot-init.c
+++ b/drivers/video/fbdev/omap2/dss/omapdss-boot-init.c
@@ -121,9 +121,11 @@ static void __init omapdss_add_to_list(struct device_node *node, bool root)
 {
        struct dss_conv_node *n = kmalloc(sizeof(struct dss_conv_node),
                GFP_KERNEL);
-       n->node = node;
-       n->root = root;
-       list_add(&n->list, &dss_conv_list);
+       if (n) {
+               n->node = node;
+               n->root = root;
+               list_add(&n->list, &dss_conv_list);
+       }
 }

 static bool __init omapdss_list_contains(const struct device_node *node)
--
1.7.9.5
Gentle ping..

-- 
Regards,
Sachin.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help