Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

video: omapdss: Fix potential null pointer dereference

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>

authored by

Sachin Kamat and committed by
Tomi Valkeinen
06f7d793 74c0554a

+5 -3
+5 -3
drivers/video/fbdev/omap2/dss/omapdss-boot-init.c
··· 121 121 { 122 122 struct dss_conv_node *n = kmalloc(sizeof(struct dss_conv_node), 123 123 GFP_KERNEL); 124 - n->node = node; 125 - n->root = root; 126 - list_add(&n->list, &dss_conv_list); 124 + if (n) { 125 + n->node = node; 126 + n->root = root; 127 + list_add(&n->list, &dss_conv_list); 128 + } 127 129 } 128 130 129 131 static bool __init omapdss_list_contains(const struct device_node *node)