From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 01A7B1991BB; Thu, 6 Jun 2024 16:10:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717690239; cv=none; b=ZtM6rC3aaml6KEpD8nOK4xyfc4QdHgO8W1U5bfl+zFI4ZwhLfLOBhk65xICKtiqmUci+j+xemiI2644BKIUW23yK1w/O6Bq+sdYA3NMg2gMtwGxFABQ0dSUF+wY+sC8qdpgqNLaSFuf7cwmCNkub7d44vvQ/uLd5wwg8+W7RXnA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717690239; c=relaxed/simple; bh=gj6vGOfIMvi9wknlVIRBepDS/CXPzi91odpfx0mTouo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=u/gOiU0V0hHtgc4PudFRi5Ove3BYJ0x2DVt751NUBX4TMKq4yLV4x2PK01CvOZWXLok7xVWmfgfbnv2SMGz6NUgfHuxWP0yc4+qklDOhMy+PbbrOdcZmMTKUbj4VAKEmOAar3a6hSRwWHWi/QXbZQdj+ezDIg9zhosSB9JNQqk8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=BWp/1rHL; arc=none smtp.client-ip=198.175.65.18 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="BWp/1rHL" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1717690238; x=1749226238; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=gj6vGOfIMvi9wknlVIRBepDS/CXPzi91odpfx0mTouo=; b=BWp/1rHLf0gWpdstKDFmaGtCVrAMgoTeKyrjZneIqCSD6KWNlhG0i+0F WQIdV+1umJbUaEJyN6wS/1JZSVbo2esa7w1fmh+o97z8dcd0CIaqKAk6D Ge9/JK+OsoBEyS0n6Td3rJdEak8KZD6rocyVjVazE4rD/kKj6fBnB46oq e7olweniMyEBQHenUipqdc1X0Wg7Nme2foKLjixuOp2hZRqsOAj+2yuQ8 KI+tyR3G3aRU/2ZmMkmUqhQBvE/GhqR9SkY4fCsWmMWudpR9lfGCDxF6X YhJVCIufhzYevair+DsAYarFFFV+LxXZqWO8tQ+0aLfflN7rY3pA1n0un A==; X-CSE-ConnectionGUID: 3aCrt+LSTneoV6NFTdDGZg== X-CSE-MsgGUID: dO6UusazQfqm79OAVsLJww== X-IronPort-AV: E=McAfee;i="6600,9927,11095"; a="14525082" X-IronPort-AV: E=Sophos;i="6.08,219,1712646000"; d="scan'208";a="14525082" Received: from orviesa007.jf.intel.com ([10.64.159.147]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2024 09:10:36 -0700 X-CSE-ConnectionGUID: 6qzv+wlwTLqiO2jXs6ZH2w== X-CSE-MsgGUID: WntpOTQdS1WOSgQljWuITw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,219,1712646000"; d="scan'208";a="38695664" Received: from black.fi.intel.com ([10.237.72.28]) by orviesa007.jf.intel.com with ESMTP; 06 Jun 2024 09:10:32 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 68B992CF; Thu, 06 Jun 2024 19:10:30 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , Sam Protsenko , Krzysztof Kozlowski , linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-samsung-soc@vger.kernel.org Cc: Michael Turquette , Stephen Boyd , Heiko Stuebner , Krzysztof Kozlowski , Sylwester Nawrocki , Chanwoo Choi , Alim Akhtar , Nobuhiro Iwamatsu Subject: [PATCH v1 2/4] clk: rockchip: Switch to use kmemdup_array() Date: Thu, 6 Jun 2024 19:09:32 +0300 Message-ID: <20240606161028.2986587-3-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20240606161028.2986587-1-andriy.shevchenko@linux.intel.com> References: <20240606161028.2986587-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-clk@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Let the kememdup_array() take care about multiplication and possible overflows. Signed-off-by: Andy Shevchenko --- drivers/clk/rockchip/clk-cpu.c | 5 ++--- drivers/clk/rockchip/clk-pll.c | 8 ++++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/clk/rockchip/clk-cpu.c b/drivers/clk/rockchip/clk-cpu.c index 6ea7fba9f9e5..398a226ad34e 100644 --- a/drivers/clk/rockchip/clk-cpu.c +++ b/drivers/clk/rockchip/clk-cpu.c @@ -369,9 +369,8 @@ struct clk *rockchip_clk_register_cpuclk(const char *name, if (nrates > 0) { cpuclk->rate_count = nrates; - cpuclk->rate_table = kmemdup(rates, - sizeof(*rates) * nrates, - GFP_KERNEL); + cpuclk->rate_table = kmemdup_array(rates, nrates, sizeof(*rates), + GFP_KERNEL); if (!cpuclk->rate_table) { ret = -ENOMEM; goto unregister_notifier; diff --git a/drivers/clk/rockchip/clk-pll.c b/drivers/clk/rockchip/clk-pll.c index 2d42eb628926..606ce5458f54 100644 --- a/drivers/clk/rockchip/clk-pll.c +++ b/drivers/clk/rockchip/clk-pll.c @@ -1136,10 +1136,10 @@ struct clk *rockchip_clk_register_pll(struct rockchip_clk_provider *ctx, len++; pll->rate_count = len; - pll->rate_table = kmemdup(rate_table, - pll->rate_count * - sizeof(struct rockchip_pll_rate_table), - GFP_KERNEL); + pll->rate_table = kmemdup_array(rate_table, + pll->rate_count, + sizeof(*pll->rate_table), + GFP_KERNEL); WARN(!pll->rate_table, "%s: could not allocate rate table for %s\n", __func__, name); -- 2.43.0.rc1.1336.g36b5255a03ac From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id ABFC5C27C55 for ; Thu, 6 Jun 2024 16:10:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=xRh4g7+tDvAi6jQKOqw1Dbwi4+mjDxMSDRMov7qq66k=; b=1Q8YQYw1txSbNg IYhakrDstPk6mB4vBdYYLrwoG1z4Ml6lJvURjRm9JfUZ8AfYT2spPI9BExK/DD+hKT9Pe61yqHJap 7P/JjtqTkRfwmeWkaBOSorvDOf7AYajJ2kxnSfYDL22i/iN3XBK5/MOlg2tPVuPuKvw/9XSX55cSY h72soAX6gla4gFxSjZ8/GJsH5tzrlGd+Jye8GkcIyj57zk5c+MJ0I5bt1fTT2O2XcoA95He7pDcs0 GtXTXUcNO9OhCzvzUh1A9zz/UD8ibu530yV3HzZpK1JANRBc8ZjXiEc2qb6M8cYGxZw6TU8igOrUi 1NFrY1WkndpiPvwzlTqg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sFFhT-0000000ARGl-05DL; Thu, 06 Jun 2024 16:10:51 +0000 Received: from mgamail.intel.com ([198.175.65.18]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sFFhJ-0000000AR8P-38Pp; Thu, 06 Jun 2024 16:10:43 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1717690242; x=1749226242; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=gj6vGOfIMvi9wknlVIRBepDS/CXPzi91odpfx0mTouo=; b=SJ2Sj9Phze6N0SA/HRjzuQT5gURLl2j+fAkdgDjbsbxnuu587oswR5/r aqciAhlIWA4k8uhjqRD7WyyTVRUWC0A/GIeb5fAaU8qEZGvJNoIbjQq9G prFQkhz2tLZ54VJZLQ2bCgD8Qtda2+paBlc4kKbcD1vpuYnwkZrUDf8Wu WUYQ9b+SiJTLbc1Sk9OLHtInYzTwpfWrBqOyWBdAeSvN3olBtcMD6Hhsn X3rCQv5dxJJ2aV6nHE+O0pPbAoQQKOpA3cYc/LoFmo9oYbbECx5pQt+5W c69xBVzfj84/APpm6f6SjryNxW7XoMM+uYMkJ0VWES6A4hLwBJiXckFG8 A==; X-CSE-ConnectionGUID: Lg2ocr2rS7uGywx7Y4Mv/g== X-CSE-MsgGUID: iO3k/i9jSyWj6jAG9cDxfQ== X-IronPort-AV: E=McAfee;i="6600,9927,11095"; a="14525079" X-IronPort-AV: E=Sophos;i="6.08,219,1712646000"; d="scan'208";a="14525079" Received: from orviesa007.jf.intel.com ([10.64.159.147]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2024 09:10:36 -0700 X-CSE-ConnectionGUID: 6qzv+wlwTLqiO2jXs6ZH2w== X-CSE-MsgGUID: WntpOTQdS1WOSgQljWuITw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,219,1712646000"; d="scan'208";a="38695664" Received: from black.fi.intel.com ([10.237.72.28]) by orviesa007.jf.intel.com with ESMTP; 06 Jun 2024 09:10:32 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 68B992CF; Thu, 06 Jun 2024 19:10:30 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , Sam Protsenko , Krzysztof Kozlowski , linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-samsung-soc@vger.kernel.org Cc: Michael Turquette , Stephen Boyd , Heiko Stuebner , Krzysztof Kozlowski , Sylwester Nawrocki , Chanwoo Choi , Alim Akhtar , Nobuhiro Iwamatsu Subject: [PATCH v1 2/4] clk: rockchip: Switch to use kmemdup_array() Date: Thu, 6 Jun 2024 19:09:32 +0300 Message-ID: <20240606161028.2986587-3-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20240606161028.2986587-1-andriy.shevchenko@linux.intel.com> References: <20240606161028.2986587-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240606_091041_952948_1725244C X-CRM114-Status: GOOD ( 11.83 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org Let the kememdup_array() take care about multiplication and possible overflows. Signed-off-by: Andy Shevchenko --- drivers/clk/rockchip/clk-cpu.c | 5 ++--- drivers/clk/rockchip/clk-pll.c | 8 ++++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/clk/rockchip/clk-cpu.c b/drivers/clk/rockchip/clk-cpu.c index 6ea7fba9f9e5..398a226ad34e 100644 --- a/drivers/clk/rockchip/clk-cpu.c +++ b/drivers/clk/rockchip/clk-cpu.c @@ -369,9 +369,8 @@ struct clk *rockchip_clk_register_cpuclk(const char *name, if (nrates > 0) { cpuclk->rate_count = nrates; - cpuclk->rate_table = kmemdup(rates, - sizeof(*rates) * nrates, - GFP_KERNEL); + cpuclk->rate_table = kmemdup_array(rates, nrates, sizeof(*rates), + GFP_KERNEL); if (!cpuclk->rate_table) { ret = -ENOMEM; goto unregister_notifier; diff --git a/drivers/clk/rockchip/clk-pll.c b/drivers/clk/rockchip/clk-pll.c index 2d42eb628926..606ce5458f54 100644 --- a/drivers/clk/rockchip/clk-pll.c +++ b/drivers/clk/rockchip/clk-pll.c @@ -1136,10 +1136,10 @@ struct clk *rockchip_clk_register_pll(struct rockchip_clk_provider *ctx, len++; pll->rate_count = len; - pll->rate_table = kmemdup(rate_table, - pll->rate_count * - sizeof(struct rockchip_pll_rate_table), - GFP_KERNEL); + pll->rate_table = kmemdup_array(rate_table, + pll->rate_count, + sizeof(*pll->rate_table), + GFP_KERNEL); WARN(!pll->rate_table, "%s: could not allocate rate table for %s\n", __func__, name); -- 2.43.0.rc1.1336.g36b5255a03ac _______________________________________________ Linux-rockchip mailing list Linux-rockchip@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-rockchip From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B62B9C27C54 for ; Thu, 6 Jun 2024 16:11:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ZPdyFiFD+49WcbLayIvQJdIH9xOrUQgySpVezFHOdWU=; b=Za5A95FPd0WsCr fKRwlQZ8VO06TQqlqrpj8qRmy3kdiidNt+qKfKDOOxmBc2u5dpGvB6HAlrDbGQkp6UKEr7nb66Vuq aQRmQIALCXb7N+PTYGF2nGlUABNzfIqgS/J/aDRWehdk3MLJFR7eL02FUEGitYmr+my3s3iDwN2HJ vwN6JCIgsOUmIPLtA8gOVwbpT6UgKE9HETVMP7SzD9KoyurVSU/1ah/4gfwcpPET6DPGWvlF/ZGex BxUabWQ5b6x6mJbby1sawpx09vULkUp4jeYP169QSBjyA2qKKAUeRUiZATQY98srtP4tQxfgD9dU9 caMIQTrEBL/66M9m+z3A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sFFhR-0000000ARFW-16s3; Thu, 06 Jun 2024 16:10:49 +0000 Received: from mgamail.intel.com ([198.175.65.18]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sFFhJ-0000000AR8P-38Pp; Thu, 06 Jun 2024 16:10:43 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1717690242; x=1749226242; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=gj6vGOfIMvi9wknlVIRBepDS/CXPzi91odpfx0mTouo=; b=SJ2Sj9Phze6N0SA/HRjzuQT5gURLl2j+fAkdgDjbsbxnuu587oswR5/r aqciAhlIWA4k8uhjqRD7WyyTVRUWC0A/GIeb5fAaU8qEZGvJNoIbjQq9G prFQkhz2tLZ54VJZLQ2bCgD8Qtda2+paBlc4kKbcD1vpuYnwkZrUDf8Wu WUYQ9b+SiJTLbc1Sk9OLHtInYzTwpfWrBqOyWBdAeSvN3olBtcMD6Hhsn X3rCQv5dxJJ2aV6nHE+O0pPbAoQQKOpA3cYc/LoFmo9oYbbECx5pQt+5W c69xBVzfj84/APpm6f6SjryNxW7XoMM+uYMkJ0VWES6A4hLwBJiXckFG8 A==; X-CSE-ConnectionGUID: Lg2ocr2rS7uGywx7Y4Mv/g== X-CSE-MsgGUID: iO3k/i9jSyWj6jAG9cDxfQ== X-IronPort-AV: E=McAfee;i="6600,9927,11095"; a="14525079" X-IronPort-AV: E=Sophos;i="6.08,219,1712646000"; d="scan'208";a="14525079" Received: from orviesa007.jf.intel.com ([10.64.159.147]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2024 09:10:36 -0700 X-CSE-ConnectionGUID: 6qzv+wlwTLqiO2jXs6ZH2w== X-CSE-MsgGUID: WntpOTQdS1WOSgQljWuITw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,219,1712646000"; d="scan'208";a="38695664" Received: from black.fi.intel.com ([10.237.72.28]) by orviesa007.jf.intel.com with ESMTP; 06 Jun 2024 09:10:32 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 68B992CF; Thu, 06 Jun 2024 19:10:30 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , Sam Protsenko , Krzysztof Kozlowski , linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-samsung-soc@vger.kernel.org Cc: Michael Turquette , Stephen Boyd , Heiko Stuebner , Krzysztof Kozlowski , Sylwester Nawrocki , Chanwoo Choi , Alim Akhtar , Nobuhiro Iwamatsu Subject: [PATCH v1 2/4] clk: rockchip: Switch to use kmemdup_array() Date: Thu, 6 Jun 2024 19:09:32 +0300 Message-ID: <20240606161028.2986587-3-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20240606161028.2986587-1-andriy.shevchenko@linux.intel.com> References: <20240606161028.2986587-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240606_091041_952948_1725244C X-CRM114-Status: GOOD ( 11.83 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Let the kememdup_array() take care about multiplication and possible overflows. Signed-off-by: Andy Shevchenko --- drivers/clk/rockchip/clk-cpu.c | 5 ++--- drivers/clk/rockchip/clk-pll.c | 8 ++++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/clk/rockchip/clk-cpu.c b/drivers/clk/rockchip/clk-cpu.c index 6ea7fba9f9e5..398a226ad34e 100644 --- a/drivers/clk/rockchip/clk-cpu.c +++ b/drivers/clk/rockchip/clk-cpu.c @@ -369,9 +369,8 @@ struct clk *rockchip_clk_register_cpuclk(const char *name, if (nrates > 0) { cpuclk->rate_count = nrates; - cpuclk->rate_table = kmemdup(rates, - sizeof(*rates) * nrates, - GFP_KERNEL); + cpuclk->rate_table = kmemdup_array(rates, nrates, sizeof(*rates), + GFP_KERNEL); if (!cpuclk->rate_table) { ret = -ENOMEM; goto unregister_notifier; diff --git a/drivers/clk/rockchip/clk-pll.c b/drivers/clk/rockchip/clk-pll.c index 2d42eb628926..606ce5458f54 100644 --- a/drivers/clk/rockchip/clk-pll.c +++ b/drivers/clk/rockchip/clk-pll.c @@ -1136,10 +1136,10 @@ struct clk *rockchip_clk_register_pll(struct rockchip_clk_provider *ctx, len++; pll->rate_count = len; - pll->rate_table = kmemdup(rate_table, - pll->rate_count * - sizeof(struct rockchip_pll_rate_table), - GFP_KERNEL); + pll->rate_table = kmemdup_array(rate_table, + pll->rate_count, + sizeof(*pll->rate_table), + GFP_KERNEL); WARN(!pll->rate_table, "%s: could not allocate rate table for %s\n", __func__, name); -- 2.43.0.rc1.1336.g36b5255a03ac _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel