lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250515201312562vXizlDSg23_PhQ1nALjYV@zte.com.cn>
Date: Thu, 15 May 2025 20:13:12 +0800 (CST)
From: <zhang.enpei@....com.cn>
To: <vireshk@...nel.org>
Cc: <nm@...com>, <sboyd@...nel.org>, <linux-pm@...r.kernel.org>,
        <linux-kernel@...r.kernel.org>
Subject: [PATCH] OPP: switch to use kmemdup_array()

From: Zhang Enpei <zhang.enpei@....com.cn>

Use kmemdup_array() to avoid multiplication and possible overflows.

Signed-off-by: Zhang Enpei <zhang.enpei@....com.cn>
---
 drivers/opp/core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/opp/core.c b/drivers/opp/core.c
index 72fbb6cadc23..d85e3371493f 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;

-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ