[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1460811003-31806-1-git-send-email-colin.king@canonical.com>
Date: Sat, 16 Apr 2016 13:50:03 +0100
From: Colin King <colin.king@...onical.com>
To: "Rafael J . Wysocki" <rafael.j.wysocki@...el.com>,
Pavel Machek <pavel@....cz>, Len Brown <len.brown@...el.com>,
linux-pm@...r.kernel.org
Cc: linux-kernel@...r.kernel.org
Subject: [PATCH] PM / clk: ensure we don't allocate a -ve size of count clks
From: Colin Ian King <colin.king@...onical.com>
It is entirely possible for of_count_phandle_wit_args to
return a -ve error return value so we need to check for this
otherwise we end up allocating a negative number of clk objects.
Signed-off-by: Colin Ian King <colin.king@...onical.com>
---
drivers/base/power/clock_ops.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/base/power/clock_ops.c b/drivers/base/power/clock_ops.c
index 0e64a1b..3657ac1 100644
--- a/drivers/base/power/clock_ops.c
+++ b/drivers/base/power/clock_ops.c
@@ -159,7 +159,7 @@ int of_pm_clk_add_clks(struct device *dev)
count = of_count_phandle_with_args(dev->of_node, "clocks",
"#clock-cells");
- if (count == 0)
+ if (count <= 0)
return -ENODEV;
clks = kcalloc(count, sizeof(*clks), GFP_KERNEL);
--
2.7.4
Powered by blists - more mailing lists