mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 19:21:31 -04:00
PM / Domains: check for negative return from of_count_phandle_with_args()
The return from of_count_phandle_with_args can be negative, so we should avoid kcalloc of a negative count of genpd_power_stat structs by sanity checking if count is zero or less. Signed-off-by: Colin Ian King <[email protected]> Acked-by: Kevin Hilman <[email protected]> Acked-by: Pavel Machek <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
This commit is contained in:
parent
411bf2a8db
commit
a1fee00dc9
1 changed files with 1 additions and 1 deletions
|
|
@ -2113,7 +2113,7 @@ int of_genpd_parse_idle_states(struct device_node *dn,
|
|||
struct of_phandle_iterator it;
|
||||
|
||||
count = of_count_phandle_with_args(dn, "domain-idle-states", NULL);
|
||||
if (!count)
|
||||
if (count <= 0)
|
||||
return -EINVAL;
|
||||
|
||||
st = kcalloc(count, sizeof(*st), GFP_KERNEL);
|
||||
|
|
|
|||
Loading…
Reference in a new issue