Commit 31fa6e2a authored by Aditya Pakki's avatar Aditya Pakki Committed by Bartlomiej Zolnierkiewicz

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: default avatarAditya Pakki <pakki001@umn.edu>
Cc: Kangjie Lu <kjlu@umn.edu>
Signed-off-by: default avatarBartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
parent 17de805a
...@@ -111,6 +111,8 @@ static void __init omapdss_omapify_node(struct device_node *node) ...@@ -111,6 +111,8 @@ static void __init omapdss_omapify_node(struct device_node *node)
new_len = prop->length + strlen(prefix) * num_strs; new_len = prop->length + strlen(prefix) * num_strs;
new_compat = kmalloc(new_len, GFP_KERNEL); new_compat = kmalloc(new_len, GFP_KERNEL);
if (!new_compat)
return;
omapdss_prefix_strcpy(new_compat, new_len, prop->value, prop->length); omapdss_prefix_strcpy(new_compat, new_len, prop->value, prop->length);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment