From patchwork Wed Aug 21 07:20:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yu Jiaoliang X-Patchwork-Id: 821315 Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2076.outbound.protection.outlook.com [40.107.215.76]) (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 2930D1B81C7; Wed, 21 Aug 2024 07:20:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.215.76 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724224829; cv=fail; b=XGI+EFfa5eafyH2GLrrjlcP5tZZ7vI3pzBI7jltB27TWIMDvoihM3ttVIqrzGJAyjH99qTwlbVftXETNzOE5AsPv7f93VQbRg9vbCgjy73yomoFl5lOPOhFP6v1kvpHehH3cU4iIpJs/c0dlCRYTEO14BzZHVIHwIF8d+oq9VSA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724224829; c=relaxed/simple; bh=9v+hYoYRVS4xyp28qhtKyJLoFj8+LpEJvXOJEsXj3N8=; h=From:To:Cc:Subject:Date:Message-Id:Content-Type:MIME-Version; b=eQHYAk4o0xcem9votGIEaYuWc1UDjNXpBxw4udnBqcGI9wfOIilu8eUn+4oLKMPIj+CBoi8r7u48O27Mc00UO18TIMd7GrQE0rre+p23vHi2XxH5P32DZutzcICmc1fyn+d5AVEefjbHw1RYB8m3aWBUy7wAlNOhX/YY+fsOuVI= 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=EWrgckZF; arc=fail smtp.client-ip=40.107.215.76 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="EWrgckZF" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=u3eVsZkP/0jSG0wOlSGKLG/THzxMfWKGBdOFZgla8h5SztH90hMTSRFS9E06IN7ZqtOWhCHcaMXuUVs5cNf45xvaWYwYi/q8Ju9P8nDs5ctUtUxceBdhjS6wPB29AltGLCnygru8XDMsXK3m1FjQS9oeSuZ0s47PNrfb7VOXaR86TWmjOQ3QjmTrpbP+KoTlx6dUtaKVIkClSVgauAapzNpQo5D8vzls0ds+ImYlr9HAkJONLyf/4fDd2OyjMHVyCNoVvpF3psvXohvDyhvhmwoeotN7Nu5bzRyEzj7GCWkbbtbJagIjzZxLn9Az0g7Y5RuO0D9Bei485A7cqn6UUQ== 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=ulqjzYFlLH+7rVvl/XnVpLsrxmoiCeu38ldhvEAWznk=; b=qrJRCt5uNYnPicurUKV1TeK1OJA6BhA0/LK/JitJj0rLTy8Fv34ZOetwIhZMHiX6MIYJijEdGKpkLwSFhhms40TYHSWulzPVJPOsMfs4glqmzRjRlzPaSu//C9l4x36RFQeMwJB2mTPK+8qBc6TWwy6a73x56kW/vwn/EU/Dx8W0lZpgFkb47UHrGy4zEpi2KSgPWFedOi+D0UuWGeBb1MCPg8vRw4qt0vU8XCSPferNhzGgQ7CQGlSW7yhK4awMQ6tITXm9h8HB7K7bSlF8VEcDwTgSJJSxg2n0H1t+Gbx4cGUjx9wCrYiQxzAk+PYuDZj89pC+/vKyFCRLNGMCgg== 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=ulqjzYFlLH+7rVvl/XnVpLsrxmoiCeu38ldhvEAWznk=; b=EWrgckZFIR2BeakoPYvVmLsq7e7zx39tGrQmfRDRc7lGZWZ0OJgtTJuo1AiUHPp/9rrjQVNJKk8UJiuM0yy4QW/goqFGriK8MUK/uTEZLpTEC19W89dV+BbIt277pbqgss9jhw1NPbdK33RT3Ocssm+HjKQWi0R0wIGey2jqcqftMljzen+uhBsgakgFPcMJ52CK0JUBCR+UnPWhs9Dy0nxGk2LpOnVQQuh7rC/gWRujYiETiwpFRhtIDZ1ESAQKtRj7G44yGKakn80ktio1RCVh8JlwgA3J0S/XqEtJpia6LHeXOZ0mps44dVQhDZpmLfw7iHl6QdsuELdKd1IWlQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from TYZPR06MB4461.apcprd06.prod.outlook.com (2603:1096:400:82::8) by TY0PR06MB6883.apcprd06.prod.outlook.com (2603:1096:405:15::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.18; Wed, 21 Aug 2024 07:20:23 +0000 Received: from TYZPR06MB4461.apcprd06.prod.outlook.com ([fe80::9c62:d1f5:ede3:1b70]) by TYZPR06MB4461.apcprd06.prod.outlook.com ([fe80::9c62:d1f5:ede3:1b70%6]) with mapi id 15.20.7875.023; Wed, 21 Aug 2024 07:20:23 +0000 From: Yu Jiaoliang To: Johannes Berg , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: opens^Crce.kernel@vivo.com Subject: [PATCH v1] net: wireless: Use kmemdup_array instead of kmemdup for multiple allocation Date: Wed, 21 Aug 2024 15:20:08 +0800 Message-Id: <20240821072008.4065483-1-yujiaoliang@vivo.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: TYCPR01CA0117.jpnprd01.prod.outlook.com (2603:1096:405:4::33) To TYZPR06MB4461.apcprd06.prod.outlook.com (2603:1096:400:82::8) Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYZPR06MB4461:EE_|TY0PR06MB6883:EE_ X-MS-Office365-Filtering-Correlation-Id: 01837e63-71be-46b0-aa40-08dcc1b1b87c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|52116014|376014|366016|38350700014; X-Microsoft-Antispam-Message-Info: LjypNFV8AKUJ7soHyrV4mPe45QedJlsunH9LobSYd7LVk6rpafttQE3b4mcu7IUeghKh8iUDASEu6Oie98tHP6jdmB1J2HLGP5jn9n3l0Sd2ytFFcg1WDnD6JbbnZp9kHIiJ1B30G1H2gTw7ULyx3GzWWvX+hG6eRbknB9cd4hSQ/a5lmYj4RvKm3Q2hpVXnySncub9ZW3tHBF8x3ZI24USHhdrW/S5oDhrC1B4IQQgZUFAuRREum+wGqauF+pe7UMcYoBubUpUmAT8XrWRolTExSk6/g7l66fADspk3ymmRQGmI05riMPrhqCP5ymGRLbihSyIl871W6f+vL05Eh113gQmkRxmQT9MvQN/akw13sglKyIcTTOkdnwwc9Nv1ZrmUWXodUgqv8oMwPGre4+49ihZi78kb2WIpHT+jfKnMvH2Qyo6Xtcfh0e3fGOfHZHTjB1yEa88dKQxkK2zrVlvyOYc2fmwUBPApcjay3n1gbAxJonD15J89AjRVGGyrKfFK844/G443n/4Z0MzuqWZMii9f75o7OAPgzmAsZ6YvM9ai+R2NrgH2F5ncgjm7uQOpJrCQjbSCzOvznb7jLpYUx2wwVhChImJEX08YlYTJHV658A3aIMvAMWEzxl0F7AAbn3abHdB3SrEy9AZ/XRLskmjd8EteIEWlXNHZ4xvF1njJYWUZfiqkzq8TvWslB6fOZz3E0SBP9V462n4j7ZpNHJDlomX4ZqfNrzyT1Xpgl+LPfgSGw0E3R96NQCzaSwFC6oBrcrukVu7Qzwyku0rBsXCkbikzsTe9Ix1DnnzQYN+ejHVbuYLEOIeQPds22vswP8M7cNBH1MEuJIAectEdRHww92opxoOdq838YlQHXcCUN7vjfsr+NO7axdCt65O+W9+OYFCoY86EqpAjqIDCLyDl59kiOcO3cxwGDp+d7ODXqftdE7DA/ENSAXSvVk2byhHzIpD0v9oCpTW7s4lcBtKsvTTSWU19+kCePEYVZDN/8MvMNGkmLN1UIB8j89jfAAZZi5TA+3OXXLMJXzmt0on/ykZKH/5tntHPTeJTK7e9PudW+tnPVmi+u0i7WPhO8gKn2gOrq4Ews/wuOBqqEq1+9Hk2+eYSaUaPkmUkdx0z8zZrjnEgnKfkeiFbLYuLYYPeu+V4Cp7xMdOGfynmHDuwqj59YuePwcIMD8ezaDIrhmQOZ8DgdVWPvgyspGxZ0DgyuQ+bWXniF4IyaK0P4ZlKtAVsH/3MSww2L0+bZMK/R3Cl1SyS0HUqSyxP4sciGafEiwpP3nrUJOxxii9kipcR2pU1A1f1XwwIrJJaLYRc01244WKrCe0z2mIyX5bINIy30/+hjEcYFCvQ4nSMVl99nEtLED705ouLvN76fGt+dMhujKx+spAmjYvB0Etlmoru/Omq6GkOHJ+FxA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:TYZPR06MB4461.apcprd06.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(52116014)(376014)(366016)(38350700014); DIR:OUT; SF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0ZqGxmnnS+Hi87MHEB0fho4C2uKp6oJREPGLMPXqQu+S+bKgxZYfUW1beGHI6AAPMnvHuKLoPn8QTTCs3l9oaqhrIVGo52/9zIhzUiNHmqzoQBbbfDiWdj9Z/XB3VZY6ZfMAhQFCZihJclDQg1Qa/qK7Z/KLCL8g5fT6yJHpZm0lSv//CrakYj2EAP5csmDVxX+pmtotoTXtur4vuLvD01fCduGZYY1FNIu8c7pcaQlqaZaJRZMtjY3gjb64dgNz0mA7EvmF05SQv8ZZLVOqKtNAXYESH7cWYm3ypoW075Gw8L9m1fp5B92bQ76w0lTuQACnvJQEXGaj2twC1qZ+XDQIxB1IMTfExsv/j1RB0XwJKhCa7Lx3lnzGzIJGnMuGbfSvAGoCuYh+3iVMm7Vp9Fz7kYA6URs12smv20RfF2AGm1xnzdikKoue4oWMgrCoOU+Zfq9damlUxGb9281dKMpgOoWFdadUWtLzbLb0FQiItwTaGH5mPT0MHpMWQhCW7ff4YOsDKIPOf7oWhMdqIN369ubFAouRT6ZOIGHVQyUxlRUa33T4dU1MnbBhSg X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 01837e63-71be-46b0-aa40-08dcc1b1b87c X-MS-Exchange-CrossTenant-AuthSource: TYZPR06MB4461.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Aug 2024 07:20:23.0203 (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: 8WTZQauRRY1q03365MlDL5WrG1VZ2R8veQ0U773+zJv1VNZyX4K2r4S3Q3xtYoNOV0PI8oS0vKulzJNIQOvzjA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TY0PR06MB6883 Let the kememdup_array() take care about multiplication and possible overflows. Signed-off-by: Yu Jiaoliang --- net/wireless/util.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/wireless/util.c b/net/wireless/util.c index 9a7c3adc8a3b..6cf19dda5d2a 100644 --- a/net/wireless/util.c +++ b/net/wireless/util.c @@ -2435,8 +2435,8 @@ int cfg80211_iter_combinations(struct wiphy *wiphy, if (params->num_different_channels > c->num_different_channels) continue; - limits = kmemdup(c->limits, sizeof(limits[0]) * c->n_limits, - GFP_KERNEL); + limits = kmemdup_array(c->limits, c->n_limits, sizeof(limits[0]), + GFP_KERNEL); if (!limits) return -ENOMEM;