提交 a1fee00d 编写于 作者: C Colin Ian King 提交者: Rafael J. Wysocki

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: NColin Ian King <colin.king@canonical.com>
Acked-by: NKevin Hilman <khilman@baylibre.com>
Acked-by: NPavel Machek <pavel@ucw.cz>
Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
上级 411bf2a8
...@@ -2113,7 +2113,7 @@ int of_genpd_parse_idle_states(struct device_node *dn, ...@@ -2113,7 +2113,7 @@ int of_genpd_parse_idle_states(struct device_node *dn,
struct of_phandle_iterator it; struct of_phandle_iterator it;
count = of_count_phandle_with_args(dn, "domain-idle-states", NULL); count = of_count_phandle_with_args(dn, "domain-idle-states", NULL);
if (!count) if (count <= 0)
return -EINVAL; return -EINVAL;
st = kcalloc(count, sizeof(*st), GFP_KERNEL); st = kcalloc(count, sizeof(*st), GFP_KERNEL);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册