From patchwork Thu Aug 22 04:41:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shen Lichuan X-Patchwork-Id: 821449 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2073.outbound.protection.outlook.com [40.107.255.73]) (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 79F8513AF2; Thu, 22 Aug 2024 04:42:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.255.73 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724301739; cv=fail; b=OI8W6rsImjVbWiCoL7jWcRZxArirQYbnxvoz5Q4isT2MELZZL2dAS8opPtIN/rV5O7okEgkcqZZ6ikXApRfXBO6JTA3zIhh06ui3+bSfV5WhUm1NvIaEmfXPotCupX+gUxOFcjlnJtytPjuGlnI7opNX4Z+Cw0FutIbgGPcoPko= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724301739; c=relaxed/simple; bh=VrY/PFmC5kLS3cEzAqqTpw3bcPikHTOk6sS9LvZSWH4=; h=From:To:Cc:Subject:Date:Message-Id:Content-Type:MIME-Version; b=F9yxsrAZ0VW9fOB0yHED+fyc+yXaX4kI4BAJS34Hp+S3Krr/uVvABQ0TpDyNtHYhjhHdd9qInT1hHBfuRzj1cMh27FRVS+0cEQuL5QuFCZhG3YvSVjiip7GD5DbwOzgBaRNcXVE6y5nr/g3NeQVcLUteuJMWdHKkw8qDolv/nT0= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com; spf=pass smtp.mailfrom=vivo.com; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b=JncvMHdi; arc=fail smtp.client-ip=40.107.255.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=vivo.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b="JncvMHdi" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=h8g4z2C+7UHDj679P8ilzOfq1YirKgShQFRpIceNGsT5zK/JxcUIlXQRp0c4+kDlD3QGJWxuem7UyAt3fiNzCxXB4fbxL3oPEopWbsn6AALZzu5/6VqksESC9tEYC78yhuEOxn4AF9bOGYjODiPR1OFFM2mY5ajIYVirB21oAd1eYzRAwUwiUv6P9W+qzR/PHpPin2jun0VZWUirIPOfXj9y5lOvmodupVKhfTirhkfgtht+8X1Th9oTXfvYrkFiDiUuMOZJKwPiPXhX8lASZzIJ8HjUVa/Gh8ZxiM7dxTAhPlXjTu4AiXn0E51RLJpwCBn7fC5SfZf8z80K4zrrTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=CqDAwsRiOcYlQ3xptTuFwr88Z38YpJJQ+WG1qE2qFWU=; b=UYGdbqO0BkOqsu173kS3XLTdQbDL8wsP2Wh3SEegugJF9nydaz48ruyrcjoISr2WLk7wmC1a9cU5CerPiBBvCJ02oLb2BXe6jXT5UMWmCWP5m6dQS92M0P8uXrol7UELYRdnMIGB3bK5uYv5vIuftkOuF9ISYN9JRxuXfo2MixJWmZ+nUB8Cev8rPLDXyvFkt0IEm+PzgKoQo7LvCg08JkGMgV5FItbaqA7Dz/KgICny8hysujgBePfFI5FFU3jDDXyyh5Jw5EKvr1gwHGntnydb4n6EyTm2XjjZIOPnz71MogsLXULLHRRIWTdCoQ2+SFmJw2UhCC+OKYMQAkIRwg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vivo.com; dmarc=pass action=none header.from=vivo.com; dkim=pass header.d=vivo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=CqDAwsRiOcYlQ3xptTuFwr88Z38YpJJQ+WG1qE2qFWU=; b=JncvMHdiKW//l9OlerperPIgV3OuAl25Q1mI8HS3KxX+AnY8TwWq/Ar+gKztkbxqisG4TX0ItDkVlH5RQBvtBBCzgczicmC6sleX0faiHoy3PMoAIcG6W2wl64BHFlD44YKPJisyzxJqfaD3GhAAjFGlUvgIC/REUo9nzpqD9iBYlhKDudY11XZtxRSICX0IQaRreX0tbuWokU6v9dIUQhswKpFT0gKjbX0C4CNqPDf1NGVC0YFvfNXUaxJzqGEWk0Z7ZwTqdpKKwm2hxhh89jUDO3x+VJO7bTTlgT2X+qgH4i7xeqWQISNZcQpmtYDIpUkKz4HQtkYQp28OgnquAQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from SEZPR06MB5899.apcprd06.prod.outlook.com (2603:1096:101:e3::16) by SI2PR06MB5139.apcprd06.prod.outlook.com (2603:1096:4:1ae::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.19; Thu, 22 Aug 2024 04:42:08 +0000 Received: from SEZPR06MB5899.apcprd06.prod.outlook.com ([fe80::8bfc:f1ee:8923:77ce]) by SEZPR06MB5899.apcprd06.prod.outlook.com ([fe80::8bfc:f1ee:8923:77ce%3]) with mapi id 15.20.7897.014; Thu, 22 Aug 2024 04:42:08 +0000 From: Shen Lichuan To: linus.walleij@linaro.org Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, opensource.kernel@vivo.com, Shen Lichuan Subject: [PATCH v1] drivers/pinctrl: Switch to use kmemdup_array() Date: Thu, 22 Aug 2024 12:41:56 +0800 Message-Id: <20240822044156.2301-1-shenlichuan@vivo.com> X-Mailer: git-send-email 2.17.1 X-ClientProxiedBy: SI1PR02CA0057.apcprd02.prod.outlook.com (2603:1096:4:1f5::10) To SEZPR06MB5899.apcprd06.prod.outlook.com (2603:1096:101:e3::16) Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5899:EE_|SI2PR06MB5139:EE_ X-MS-Office365-Filtering-Correlation-Id: b6b6b5ff-22c0-4075-d14c-08dcc264c774 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|366016|1800799024|52116014|376014|38350700014; X-Microsoft-Antispam-Message-Info: 1kayZMzoco7aP8ObqYLLlC77LwE0Dhq67FZvHCT2uF0v4MroLTqWmQOfVLi+d+7ppJdgoCiR58+lM56HSsnlnSuxBf7WNfd86oHxSX5vWISAT2/SeX3AETSs725Nyau3eXnM/SHQexc340SBLNFBRT2kHIfMfOFtHGQ1vztDSDg3obClB+DNudBHoVwC7IbmkqHK2JVl8sMCAjICshoQPmgOnl7q495VLym5ReXSyN8nL0b0X5Ojve4kjh7z6kZYlUZxASFz/URPR7hcEmXTa2gg4DzXRCadx51HeXzJV6K2jjQP3Tl4Hzj8F2DNwZqCbQYzlxx3aC/WgCzZCFDKH7sztwm0q0iQiAIZLFoOPKlWtzwE5eKUA0iksnn4/gZ7YdbDlYjFhOaC8kg8RWSQy1wItQOIX/DXAcvRsM4yKgquUfZcWIAnxWbZsy1pYvfVLuSXQpXpva+CuRkHnP//1YoaTgs/wat4ZygHNa/k/43fQ7HyehEqDdvcyWztn0ZdjM7YLqsX4X5cNZ9x658xuPpN6bl8+tDiLhhvfqfamMC5M7L2O8Mr98UPNURH7vvdGeVVDcOB2Mt3A4l4axF0HRzMxhj18G5qOj3wjppeHhCvDJ7yVa9u14jpJ9rx4qYnr3txD2GcQscSFzGJZV//qtz0nx+BlaJmpAVMAdjabSjs/aInnpIS8jyB57QWRDuGFKtXE+chma5WcY2pN9w3PS4pAZgv8t2WhfjqNuWGFMaVErNY9topbEKq6SlWNXAmazKgJthEWDQX6918AzwoL26PfaMOmA99ImNNLSIHxmA/96Kvgv60DzuMMUy98d44TrNf448TaI79F3y2vNOxZ/M5Ay5cJL67GszTm0Z/AaFqHw1JdSxSsazkk83tCPYOShcO5uu4OK2caHLoJGL5mFOdKkBj3n5r5bwkPc7GHn8gramLV5MSvAaCfRn2RXl146JVHin3Gxp6TbI8i42j9Tsj1Q/SLZONLigT5rhA9Hfvy0hF/IUT7x/f+K132HCYybEuric1P81AI9hzobo7p7PxsEqhL3UsceyAfSqsRxYmGq9hmLRI1XFg90eLQVU59Tu7ry4L45Hyw0TGPlJdmy1o6su7qX0SvFTi7mB6D/44ghTLeILUO4OQ7HBMkDTLgKuxp43s8+NL7EvSvxrWTojyDBE/LgIqoPbO732MFHxmVVx8w3Z6aFvCDEpjRRCsutq0WVZ6/Sj+JMHilbcJFHQ5/Qj2weiqsVl+AIVYTgGbA1hHDN/046RCTYve9pXySwTQ7YxzpGO28FX+cq5VJjHLk763L+8ypaZl/yMkCkedtjXcAYPsMR3abz8zwTiuiz4JeJfAoupVJa8Mzn/y9glhdEpONZYmoBbtCCxckFqLmFmqKv95k0oG9KQ9Kl8O3p+Lhl8rjOq+yEcnsNNQLw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SEZPR06MB5899.apcprd06.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(1800799024)(52116014)(376014)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-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9M8HzI5mTOSYAUXsbayoOAGCuQ3t1MhyaFNoACAICl54qa2FIwRo+ZXhOaM8c/capqIyXbS3dtNgoGT507NAkeiZLkYJ5qx3YZzaoMzokBAiQlpfaNmpJC5VhR/F6QEy9A2qfuiD9tJ5q2TmVMFS8G3JLvU474rpxxQqXRmHnUgSxu0E5hB9dHhWOR8VfDK0j9iu3TZg7mpwOh5lZEiaHp0epg6QSFGHy0U7PwvvuOcu7e/4SP6tF0grXJ1jldsE32u7bUVRSvieDEXKo6sy89dWlZ9xjlPkRUfI7ZugkvB+Qb5DLSGE8AXCIRE1SqRekXF/kIXYtywiv8M8UHdlsWWHqRg7baZtT+ddGfBcIVibUWOLCmASm3WGJe4lk8vdEwf8pzYc5H2wVp64EX5+LZvQMh9kqzsMh0lk7YOejTSLtqjdjdWoscGOplvq8tBNQDAuqH1mLHJTZiD90QsD3gYkUe6/KJapJD4ruy2LBlJPICiMvEdf2dQc1lf0/VDj8bWO94wyVW6NsHVVROLToLguqX643mC4QoIDpVB X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: b6b6b5ff-22c0-4075-d14c-08dcc264c774 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5899.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Aug 2024 04:42:08.0763 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 923e42dc-48d5-4cbe-b582-1a797a6412ed X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: M671UQog68+bYvXulsBZdibFKNm4WagR/saoqEMwclw2g+HLajB4Ny33BBu0TqGZJswph3oBR1VD3UqSdY9U6w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SI2PR06MB5139 Let the kememdup_array() take care about multiplication and possible overflows. Signed-off-by: Shen Lichuan --- drivers/pinctrl/pinctrl-utils.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/pinctrl/pinctrl-utils.c b/drivers/pinctrl/pinctrl-utils.c index d81d7b46116c..f18903de1d71 100644 --- a/drivers/pinctrl/pinctrl-utils.c +++ b/drivers/pinctrl/pinctrl-utils.c @@ -70,8 +70,8 @@ int pinctrl_utils_add_map_configs(struct pinctrl_dev *pctldev, if (WARN_ON(*num_maps == *reserved_maps)) return -ENOSPC; - dup_configs = kmemdup(configs, num_configs * sizeof(*dup_configs), - GFP_KERNEL); + dup_configs = kmemdup_array(configs, num_configs, + sizeof(*dup_configs), GFP_KERNEL); if (!dup_configs) return -ENOMEM;