3
0
Fork 0
forked from mirrors/linux

OPP: switch to use kmemdup_array()

Use kmemdup_array() to avoid multiplication and possible overflows.

Signed-off-by: Zhang Enpei <zhang.enpei@zte.com.cn>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
This commit is contained in:
Zhang Enpei 2025-05-15 20:13:12 +08:00 committed by Viresh Kumar
parent ee3de3cf70
commit 03eadcbd98

View file

@ -2087,8 +2087,8 @@ static int _opp_set_supported_hw(struct opp_table *opp_table,
if (opp_table->supported_hw)
return 0;
opp_table->supported_hw = kmemdup(versions, count * sizeof(*versions),
GFP_KERNEL);
opp_table->supported_hw = kmemdup_array(versions, count,
sizeof(*versions), GFP_KERNEL);
if (!opp_table->supported_hw)
return -ENOMEM;