You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
PM / clk: ensure we don't allocate a -ve size of count clks
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@canonical.com> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
committed by
Rafael J. Wysocki
parent
02da2d7217
commit
0b26985a7d
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user