On Wed, May 11, 2011 at 5:57 AM, Rajendra Nayak rnayak@ti.com wrote:
Quite often in the kernel, there are instances of clk_get calls being made with a NULL struct device pointer being passed. Not checking for such cases could lead to a NULL pointer dereference.
Signed-off-by: Rajendra Nayak rnayak@ti.com
Thanks Rajendra,
I've already got a fix for this in my devicetree/test branch.
g.
based on git://git.secretlab.ca/git/linux-2.6 devicetree/test
drivers/of/clock.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/of/clock.c b/drivers/of/clock.c index a49f79f..cbca319 100644 --- a/drivers/of/clock.c +++ b/drivers/of/clock.c @@ -91,7 +91,7 @@ static struct clk *__of_clk_get_from_provider(struct device_node *np, const char
struct clk *of_clk_get(struct device *dev, const char *id) {
- struct device_node *provnode;
- struct device_node *provnode, *of_node;
u32 provhandle; int sz; struct clk *clk; @@ -103,7 +103,8 @@ struct clk *of_clk_get(struct device *dev, const char *id) dev_dbg(dev, "Looking up %s-clock from device tree\n", id);
snprintf(prop_name, 32, "%s-clock", id ? id : "bus");
- prop = of_get_property(dev->of_node, prop_name, &sz);
- of_node = dev ? dev->of_node : NULL;
- prop = of_get_property(of_node, prop_name, &sz);
if (!prop || sz < 4) return NULL;
-- 1.7.0.4