diff options
author | Sachin Kamat <sachin.kamat@linaro.org> | 2014-05-30 06:26:34 -0400 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2014-06-26 07:40:15 -0400 |
commit | 06f7d7931752ee1bd0903a38b1086c7ea5e10cdf (patch) | |
tree | f8045e472d9bd56d5c4f0bb11de25b194b4dd00a /drivers/video | |
parent | 74c0554ac79ef5aecfeb087bc08771363b221c99 (diff) |
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>
Diffstat (limited to 'drivers/video')
-rw-r--r-- | drivers/video/fbdev/omap2/dss/omapdss-boot-init.c | 8 |
1 files changed, 5 insertions, 3 deletions
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) | |||
121 | { | 121 | { |
122 | struct dss_conv_node *n = kmalloc(sizeof(struct dss_conv_node), | 122 | struct dss_conv_node *n = kmalloc(sizeof(struct dss_conv_node), |
123 | GFP_KERNEL); | 123 | GFP_KERNEL); |
124 | n->node = node; | 124 | if (n) { |
125 | n->root = root; | 125 | n->node = node; |
126 | list_add(&n->list, &dss_conv_list); | 126 | n->root = root; |
127 | list_add(&n->list, &dss_conv_list); | ||
128 | } | ||
127 | } | 129 | } |
128 | 130 | ||
129 | static bool __init omapdss_list_contains(const struct device_node *node) | 131 | static bool __init omapdss_list_contains(const struct device_node *node) |