From patchwork Fri Aug 23 01:39:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shen Lichuan X-Patchwork-Id: 13774492 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2051.outbound.protection.outlook.com [40.107.255.51]) (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 91DAD171A7 for ; Fri, 23 Aug 2024 01:41:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.255.51 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724377300; cv=fail; b=WW+lP1gqTe8cjweBEWmDk2wyCHitKjqKO0mmzNyFHS6pjGnCp9YrucfLlJAclFrhZF2eIelrbGLMy6S0vOuFhg7zZpS4B8gq692E1DGx9v+NDg3di3KEw2eUJkMgV6XEvLMigXOjTIvL4v8KPYIskxK1NMr/dTCjKX/499ESs78= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724377300; c=relaxed/simple; bh=hJX8137NoEFqWhbz1YAuVyotRLRPE616J3aXgTMe9jY=; h=From:To:Cc:Subject:Date:Message-Id:Content-Type:MIME-Version; b=F8Zwe/IaHn7ukF6AU2TF1c1w2px1Cb9Ho04Rb04B8CQjKKlzhe/lQBf7pzoJG/k10kBbv28dqnJ+rWT5mCMHg59/6iWp6qIP4mLR/Z/q6IAA3OUGkdjs1OfafrBI3c72bBiccrwlJT23dFEbenc5KMLWVcp3XtTz3P87zZm0rKg= 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=e/SL3RxB; arc=fail smtp.client-ip=40.107.255.51 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="e/SL3RxB" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=NiSeh9idAFBe29tfKcRquiVc+O3Q2SsInI6avtZxas7DwGYBSU9iX9Wq76epDg+0VjQ6PCb+2tuxT3/rLvDrXnUkpxyBNMdrJa4yC8PI0kZLCnASdF5WyV6iZLZPnx0A880joASPH4jl7hgGN5M8mdtN+FQFfF323CTREbIjDzB4SbZeDgD0nrNrAg0dUNH2bsC+YXShj8t7RYtpLmicBZLEJpEVUGx/VHra0wuFLQzsGK3Mt3p3F4HxYGVNtQQ63awk3ihyaykhid/nebz7P8xhT5+Ssi4Vnqj9WJ/63rwHYYFYI/TBYk062CtjibtRxJJmIPZD6KOGopMpAyINhw== 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=sIpukaCRihRcpwDsbZDPMDTFsJu9GC7x3aa4ItMNLlI=; b=WkXsdnawY4o+mPnEnootyuqpUMSMI8c7h+YW5YlapF2wGgqoDNNjM8yXEGOSMB8IpPDAlSDXgFAIQf0II5+NmumgCzZjrnJz+tVAE9+8KK96sE3+A368OS67QU7+99FcwyurnaVejnj+toG/hhB/THBdN00hUmb/bRikG1hcW0pW4rIZLbum3paOlMsZ1JhJSzJ0hbeegTNefjUlDsJT2CqYzuv0mdaDDEl9wvi8VwoxCYt1206xLV0EAUzW4r0SreT+37Rpc0RLVc9oks37iBlogEZUSS8puUTGn4RZIPoxj08Ms1plbJDvjd0PJ3W7GnP2Ykw2Ik1P7lkbEKnnjA== 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=sIpukaCRihRcpwDsbZDPMDTFsJu9GC7x3aa4ItMNLlI=; b=e/SL3RxBmQGOBepz1Z9f0oWeR2a2TWBxJ856J4kQv1B/Ni04tFPqve4KEGoPy/BE898BNEG8lSvhrZiUW06JzljsHCxeJzIIq+E1auljXmDkT0zs2PdPt5rLRkW0Tp+nloEnRF934r5cymrT2l0Z8ECOWv4zuqvCh7z6hFY6M/jhJV4JQLuzDuJbZHwIXizzZ3Zr9LO+Jiyzh/c56jIbkQnM8afI4YnkJAWD6p1XjNggtHtZ4fiz0wbObtN4UF1Jx+NUpxYZosldd5ijpgAbvGF7CXoU1mYE6ZjYIPvtsvTfKxW2DCBNUAts4cfaPrWM/rTg7tsC0SW5ECa1GbDSiQ== 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 TYSPR06MB7259.apcprd06.prod.outlook.com (2603:1096:405:86::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.19; Fri, 23 Aug 2024 01:41:34 +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; Fri, 23 Aug 2024 01:41:34 +0000 From: Shen Lichuan To: aisheng.dong@nxp.com, festevam@gmail.com, shawnguo@kernel.org, ping.bai@nxp.com, linus.walleij@linaro.org, s.hauer@pengutronix.de Cc: kernel@pengutronix.de, linux-gpio@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Shen Lichuan Subject: [PATCH v1] drivers/pinctrl/freescale: Use kmemdup_array instead of kmemdup for multiple allocation Date: Fri, 23 Aug 2024 09:39:59 +0800 Message-Id: <20240823013959.6281-1-shenlichuan@vivo.com> X-Mailer: git-send-email 2.17.1 X-ClientProxiedBy: SG2PR01CA0146.apcprd01.prod.exchangelabs.com (2603:1096:4:8f::26) To SEZPR06MB5899.apcprd06.prod.outlook.com (2603:1096:101:e3::16) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5899:EE_|TYSPR06MB7259:EE_ X-MS-Office365-Filtering-Correlation-Id: 44307ba1-c0ad-489b-01ea-08dcc314b867 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|52116014|7416014|376014|366016|38350700014; X-Microsoft-Antispam-Message-Info: j3fJIsbEsxLd2tl13LhMwRBzKtgoKDkdCPt9/YVRAxz3r3t9EPWgugTBK3P8p1uEA4R2kq1ngU4/Ycx1DGD2NTQYYFXeyFxgGdclr3A7160QV6Cfw2DOIPWhJQhyPj1llg0ICR1UFTF1LjvOJ2O9qtrUuiNFnKjYgvdgL5wd2+cnxvPufUHBJD44NTgvFRrWoj9rqhYfdpl3kE3Kz97tUofJzbBRVYq4ussXQ9tI30T2T0kr7BKO/dK2oBmwqjkGUSckmSkooGX5ZmxkgRSO5ygY5k2a13QJH76HmFMIYQExNmRzFna0eEqyxNK/eIRRlIISyjX7ivZr3jXlqEnKXB2GO3xh8ZnigRF1vbCDUwA+z5rpaohWbdJx7CLyY68tDFN57jeeqWIiOB3yAKwtZdQ/xPJbBwcYmSeBJRWzmeg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ZPR06MB5899.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(52116014)(7416014)(376014)(366016)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: OlkaJTeRo3n/l/XDPR/s62B+Rs9tRysgV/moRMGAbsI+Nquk71YvD8r/XcGqMh0nVAyrPv6gtwFHhPCfzyhNpkzJMufqwjS5lnQAw8DRTlJh6T2VBMkMWNVH9w34V8MNZAdOkO9YxEMbIEbGMak8dVP87NBMPYjIMf+cssBG81nAzejX/AygATmP7PVaOVPCgmCIHKDfAArF6wTIkWgSM574jmcbMVfrmo8nJ3vO9TggzAcAOR9xKgOHqOlafyUR725QGxh/8y8nzu8zRLjreLhzrElwLi1ATAjeWs9uetI0yDsrc67S3v2w2NjHKem2D6oENJWE79HIV/VfWT6MItwJjEEUiDyy7ZFM4yVv99d82nJuGD8yVKkr6NU6PIqyJ4HjZ6MSHpL2uYscd3tJxfzW0qglmfnrYfNaRGwRGx3HnAc8/k/B5Znv9E2V9VlqSCcctMQsnZBFZYLgIajcBc4aUaRmqhKi3DSr6GuBwQqal/8E9aQbvCp20r+YWSLqICNzj9XqmJLIH5pg2SDnO/9lH4VOWxlBwpzxEj7mmSvdEFff3jUnm9zNA2yUeyysDEtnDLbf/XkOJQFA2D4yHJitsDBkU4bn4qQwkZL6uovO0Kq9vUjPCuN9yrOzpu1e0u8us5vLYvS6XI4msnJW9xs6W1KkIA8bE3PZGE6dAUow5iJQL6NNk22o0W12BKG2bQnjgWNXT/fOnF7aLZB7g3GqDkinXpJcT9qyKZJMHFz3JTLHwOztCU60WeuQQmbSpKKpBJuwwEe5kfC7cNWwVpi8eIbGEJLScpf7AqZdVNTdzKtZSyl85KJSKS3BBEvYjsp0WJgV6f3N66CNXKJHyAftkUKO2cduCDdSp1xEhUutNbnl5xHKbLQZTYO6i0IgPgIcHbosGWPpgxVyo44esmGF1oCAP/u4T8BPk8BYkwzU/H5S376/f5548k31K8Zs13f2hrt5Jsw6uhcvSXMxQ8D0sqmBiRBQKqvyTTHNIIUFkfg3DEK8XgNPZLH3AyS/z1rtszov4CbW6DycWgSoXpqNIQJJuZltnLkHRrdB5cknyN0utt1qzJqmPnovjubU8+StMaoXRrizGdvwbtZHjuU4DEBp10hnkgXlY1dR+gSxg4LyutQi7HBwRQcRgACRl6AgV4RZRTu0Jry9sW/urW7TkT2YLvK/G+IBMMNVNGZ7wdNkK/0X3Hd3yX5vGE8KzvJ/NJgEnhPnCQD8OCQrBsA+v4IA/9DBxG6EIxA7241iWiGViAagS/VGrZp7YVBHyfREtmIUuL5hUr50c4eGsfZINI/ZdlNOfBuqRoB2bMEugcdfOgdnaMBEo9bJ3Jmo6jLXWzHBdqoZEzd1zjDNA5X+ZsDXWq0WqWQVpLgwD0545q3ZxDVfn8FID0FURNwDgcrpzC3HOjRl1vlSedeZLnQdF4l40IeiEXK/4v0Cs8kqKJxklUVpoTyO/QzkAxxLVNNQgcxGblnZWP+SXA8eqSGIv1A5X/1I6HFJ4FYpFTIct0/AA/Kft6AoBHttT1gwFuIsJb4rn95akGt+E50PigGlviLZIzmbSgfRDMIzFEM6dq9zoR2dPVGhHDvahgZI X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 44307ba1-c0ad-489b-01ea-08dcc314b867 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5899.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Aug 2024 01:41:34.2444 (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: PjqyvcvFBxYSzpgXbcmVtJlNLIusZehlVccbzJPSe5PUdckorxU4BkcK3HcB86xACBUFyg7e5laJB6t7jD2ukQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYSPR06MB7259 Let the kememdup_array() take care about multiplication and possible overflows. Signed-off-by: Shen Lichuan Reviewed-by: Peng Fan --- drivers/pinctrl/freescale/pinctrl-imx-scmi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pinctrl/freescale/pinctrl-imx-scmi.c b/drivers/pinctrl/freescale/pinctrl-imx-scmi.c index 2991047535bc..8f15c4c4dc44 100644 --- a/drivers/pinctrl/freescale/pinctrl-imx-scmi.c +++ b/drivers/pinctrl/freescale/pinctrl-imx-scmi.c @@ -130,7 +130,7 @@ static int pinctrl_scmi_imx_dt_node_to_map(struct pinctrl_dev *pctldev, cfg[j++] = pinconf_to_config_packed(IMX_SCMI_PIN_DAISY_CFG, input_val); } - configs = kmemdup(cfg, ncfg * sizeof(unsigned long), GFP_KERNEL); + configs = kmemdup_array(cfg, ncfg, sizeof(unsigned long), GFP_KERNEL); new_map[i].type = PIN_MAP_TYPE_CONFIGS_PIN; new_map[i].data.configs.group_or_pin = pin_get_name(pctldev, pin_id);