Skip to content

Commit

Permalink
video: omapdss: Fix potential null pointer dereference
Browse files Browse the repository at this point in the history
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 <sachin.kamat@linaro.org>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
  • Loading branch information
Sachin Kamat authored and Tomi Valkeinen committed Jun 26, 2014
1 parent 74c0554 commit 06f7d79
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions drivers/video/fbdev/omap2/dss/omapdss-boot-init.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 06f7d79

Please sign in to comment.