From: Sachin Kamat Date: Fri, 30 May 2014 10:26:34 +0000 (+0530) Subject: video: omapdss: Fix potential null pointer dereference X-Git-Tag: MMI-PSA29.97-13-9~11982^2~1 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=06f7d7931752ee1bd0903a38b1086c7ea5e10cdf;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git 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 Signed-off-by: Tomi Valkeinen --- 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)