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

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
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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);