Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp487919lqt; Thu, 6 Jun 2024 09:12:56 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWlFN+R4SFL7WCTAp7uNK4i0jxbvAxOaLhX2aj/cpnYjSch4607yrp+X1eGE+HqbaZB9SLx050WG9XQroWD3qnMFjQY1bQ0Ds/IJKRarQ== X-Google-Smtp-Source: AGHT+IE0H/KIj8OzOQb/UQV8UFlwphb1YVEOEssPZr/xKHaxtuatz9gvYSVL7KhGTZotzy2VaOWh X-Received: by 2002:a05:620a:2a0f:b0:795:1ede:3c1c with SMTP id af79cd13be357-7952f0b8b5bmr579199785a.6.1717690375854; Thu, 06 Jun 2024 09:12:55 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717690375; cv=pass; d=google.com; s=arc-20160816; b=taVI2k5CH+0ioC/xc80yGOistd43nQRkUuZ3iCgomO+SfIyysdD4kYssl1LpouptkC hcBUo43DTN2YVzAi7jqck5N0rVwJbCBGO3CUK/FeJOauk/Y4k22qqgMYSH8NOBYV5ueI mndCS2G040ciYzn9QVbBqL43+Znc7OUzQ1UtpqqYLI+PmpVuqf1xuic+j3r8SoKHtjsW wa60NzotIBVD09RDnnLT47ryuDrgRJSZKvmqE+Zyww+eusUr1Dh38FSWBREqx4kMPLAz bJFGhIJ1TspQvGHFevnuVJYzt9fES+QYOqRdOx2+zN2IuuIV46Rlp0mzSThSc3wWQfH5 LTdQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=PlhW/r8rFCr+pDugk1zjuOAmjw1gkI+0hth+5bkOCDg=; fh=/L17KR6uLzrKTac61HyP81Lgj0mZrWjs9Ul61xLMewQ=; b=CjPiMF5BE0wRuwLC1Cr0yDJlFXdMu2WWwgMD+vSYXL98AQxy1x3XH9Ybz8RqVAsTXC 8MP5h2oXuXFv4SIEXXWjWg47yXOT6vxzX+yZxnCvORWNKKK9xnCst/mWF5FOQyLc++JB zQRajrE6/PeCTvU+9yzrg2AhtC6LJJRsiHM+VjF1VBSasA9qgzPFpRMsyX/8AQMoJPaa wRUOTvKuOVGOzrF0AXcrOOHEyAwxumU70AHNnD8Cwo3+wwCWVb0NopEShbYdq7USjWWx x1QKsS0ljmAEqUND8fm05djLzUwbPsOVaVsxGhRrSHvqjL6b1edgTOzspl0PVCgfmrTF SJsA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=PmbzLCX5; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-204658-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204658-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id af79cd13be357-7953338e4f8si122819985a.709.2024.06.06.09.12.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 09:12:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-204658-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=PmbzLCX5; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-204658-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204658-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 6F8661C24F0F for ; Thu, 6 Jun 2024 16:12:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 82488199384; Thu, 6 Jun 2024 16:10:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="PmbzLCX5" 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 12BFA1991CF; Thu, 6 Jun 2024 16:10:39 +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=1717690240; cv=none; b=beqIGroO+idNxgUz8iZDodiaeT6e2Eq1doXPTUaLaCCMkZDoLtel1Gf4ik0I8bvT/ttVsgjdSQV1Qma/Ej9ruz85UPuD7oHCHQ6phQCIl4lRe39gooVofyONlhNkNjmSIOw7DVz4TZzumux19771Im2fqGF/OkixNrEk7WXWHuo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717690240; c=relaxed/simple; bh=xWWZ+gaYkDL6L7se9sOsqYkVgD6gieTPbfInOylbZ7E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MWaun8n1qQ9UafH8VXqb78nmslSsqAlJ4EMfAe/g1oSMeJ7A1byKgb/1TdkhwpiNMt5R25ad1jyXlbHqflF6Jih3/bwtkkfsNjL+P0boS4TnTYSSTrqwv/7ijF8ILMwJOL/JRWeDxwG2b5NdRLjQBdwlNXAExZRxq2k+urxx42Y= 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=PmbzLCX5; 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1717690240; x=1749226240; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=xWWZ+gaYkDL6L7se9sOsqYkVgD6gieTPbfInOylbZ7E=; b=PmbzLCX5odknoa1cktfGTlY+1e2poAxxoNTflkDvOp6sWOLLQiOPqqbk smJ3ptzEXz3oiSNSGbpWRlHQSxBblevOtXDivybZFJDIABuRtn7K8vAi4 Mdn6ZcKQpiiRLcZDs/APQP9oW9BghnF90OWNEE4PxtL1QkA4lfDO8FNts naiKXJsougpF6aVfZcB3QzAkrszUmTQWgVQKe3jRC450wgvUu9oaAjAo+ f+lgzrpm8KPlUp++2nWocXYRgwr6rP8okK/xP1Rzru8boKB7udACrzNkW e3qrZOHcYruOJOVJ+PHM7S+t3bDS1yvL3eJtvDrx0bVcF7Rm/2Yv4bIom Q==; X-CSE-ConnectionGUID: RvPNPuMJQb+cfrCkPlLbbQ== X-CSE-MsgGUID: T365XC7wQA6NkNfkefOPvg== X-IronPort-AV: E=McAfee;i="6600,9927,11095"; a="14525091" X-IronPort-AV: E=Sophos;i="6.08,219,1712646000"; d="scan'208";a="14525091" 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: d7XDmZzjTU2ZhgGmzyFAEg== X-CSE-MsgGUID: z077FzzDS26beD27llOV4w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,219,1712646000"; d="scan'208";a="38695667" 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 7F778371; 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 4/4] clk: visconti: Switch to use kmemdup_array() Date: Thu, 6 Jun 2024 19:09:34 +0300 Message-ID: <20240606161028.2986587-5-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-kernel@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/visconti/pll.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/clk/visconti/pll.c b/drivers/clk/visconti/pll.c index e9cd80e085dc..3f929cf8dd2f 100644 --- a/drivers/clk/visconti/pll.c +++ b/drivers/clk/visconti/pll.c @@ -262,9 +262,9 @@ static struct clk_hw *visconti_register_pll(struct visconti_pll_provider *ctx, for (len = 0; rate_table[len].rate != 0; ) len++; pll->rate_count = len; - pll->rate_table = kmemdup(rate_table, - pll->rate_count * sizeof(struct visconti_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); init.ops = &visconti_pll_ops; -- 2.43.0.rc1.1336.g36b5255a03ac