From: Zhang Enpei Date: Thu, 15 May 2025 12:13:12 +0000 (+0800) Subject: OPP: switch to use kmemdup_array() X-Git-Tag: v6.16-rc1~160^2~5^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=03eadcbd981b4c9b10ec89a046deeccb115c98b3;p=thirdparty%2Flinux.git OPP: switch to use kmemdup_array() Use kmemdup_array() to avoid multiplication and possible overflows. Signed-off-by: Zhang Enpei Signed-off-by: Viresh Kumar --- diff --git a/drivers/opp/core.c b/drivers/opp/core.c index 72fbb6cadc23d..edbd60501cf00 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -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;