From patchwork Fri Aug 23 08:25:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yan Zhen X-Patchwork-Id: 1975933 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=RpYGSEax; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=vivo.com header.i=@vivo.com header.a=rsa-sha256 header.s=selector2 header.b=CjAeMmwY; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WqtpT03mVz1ybW for ; Fri, 23 Aug 2024 18:41:35 +1000 (AEST) 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: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:In-Reply-To:References: List-Owner; bh=aby0Vlixm+vLCBWvTqpjWIB8cTy9oKiWYWEkUtJgGEk=; b=RpYGSEax9JQ2sK MTPyXXu3bzcMV836g+v7uq5+y68SP3E8+yZmQ6QVM8qGKbgynp8tIsN/sZdL+sxrlTr6LrpJac3nh 4Zh10Z1Qx5UBuWMUTtFaZDFzWWJ4fDDLQIIidJv7S8R9oeoG8HY86n6N1PNB/4sg7B3pe6/4aCT+v 4ZWlMP9c2t6yvdrxFDGMFLmQqMyw6b21oWSIzxOT5FDpO7VGvfP9I2S5AxlBUQMYknYpaq5Q7f9Xa YQ+AGj/2YPuI6CgFtpuFrfY1+oHXzy5TF17Rl5HniU2AQoe8LgpffdxRnBlOHN/uZz3IX+8oI/nT9 LB1Tgw0NePan+qLHBakw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1shPrF-0000000FvVp-1Vi5; Fri, 23 Aug 2024 08:41:21 +0000 Received: from mail-sgaapc01on2061c.outbound.protection.outlook.com ([2a01:111:f400:feab::61c] helo=APC01-SG2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1shPct-0000000Frfa-34Yp for linux-mtd@lists.infradead.org; Fri, 23 Aug 2024 08:26:33 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=XAK4+WyKnzaddSuEcYXukvcEvdIOcXJ/z0yoefoNI0fx24giJyvOfcEKJquK+f+qdv+eVmwTGG4SygBNYxRFY6FaADva0Ru6FABzGWF8yoHtb/WUojATWJz83YnD+QFvkkhG1oc6DUPYSfcKZm2WSpCXEMpVLcPfrbz+RXNNXVTKN4f0vEUm5ulGk18A0TuT86OWiVsZMPrFu54wU0MZ1rHyneaBP6TczLvCk1Qok5c/0UKVDODjCQs9RyWxdbFT3P6KFUPUOUIgTh6lW1nidsvcUUi2/XTAdS+B4SkDvhaUOf2DSJh7k9vEwQGInJTxDm6CrHTP/laeQY9e/WdKog== 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=XY3vWtOHCSD9B4tWbGYH55yrwdV/9Lq5vEdNt96cMME=; b=SsUpqeWKauIRUxLNVSJFNtjWlsmHr6nz/e2Ldx8qMZV8wbKspYWsu2IhwhJpHSEYzZjdHcf7Ulbvut4IVzGwLvbwPZOEqtSsx4s4oO+eMJxmL/OS4PNiUFB//RRr6CAVlRcqRs7mukM5AdAjBjM9crT95lAEM95A7hQ0CGIRM2qoUvEAcG/Ad7BfFyOdoCezvJr+jOrmhgx2rBVmQ1jzqzH7PqSY7eglCuwY8ZKIdaiDmsFFiDPM4feeuo3VUJyPivSlRBdpTC7BBGc02akhOZNOJUmabLozWC5vQoQw6QG6tnZwxD/PNXPxBkrkF22b2HkIf5+Z4qs561WyelhOXA== 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=XY3vWtOHCSD9B4tWbGYH55yrwdV/9Lq5vEdNt96cMME=; b=CjAeMmwYKjYO8K6v3HXWeMBUJH4w7DN1eJ8Ji55QtFy9SqCq/sM1T/9r8v9k7gbqeRtEwFej6oR8SlpWRNWWxiMXBrg+TyuLSHxjUub+kfkEJ0Zhr8vRsXN3n+I1Dg34/D4kJNsaLS9c0s+y75uSqlp8BEcJaVOctEQ7s0lOyQVy4Wi4eN5jKWNNpFTg1wbZghWOMVfQd6r0ZIyrbbt78wdWxx3ryE4QbCEptD/xYbBF9Kcfx7ROxY+7BHh73Dkw1u08g/o2qaLBOC9TDFUWMJbTuadG7ZjXIGWTVPSKhtYK9gyweZHHMQD0SzioffK+m99jvk7TCOJWee0DRAUIqg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from KL1PR0601MB4113.apcprd06.prod.outlook.com (2603:1096:820:31::7) by TYUPR06MB6149.apcprd06.prod.outlook.com (2603:1096:400:354::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.21; Fri, 23 Aug 2024 08:26:23 +0000 Received: from KL1PR0601MB4113.apcprd06.prod.outlook.com ([fe80::7e85:dad0:3f7:78a1]) by KL1PR0601MB4113.apcprd06.prod.outlook.com ([fe80::7e85:dad0:3f7:78a1%4]) with mapi id 15.20.7897.014; Fri, 23 Aug 2024 08:26:22 +0000 From: Yan Zhen To: vigneshr@ti.com, miquel.raynal@bootlin.com, richard@nod.at Cc: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, opensource.kernel@vivo.com, Yan Zhen Subject: [PATCH v1] mtd:concat:Switch to use kmemdup_array() Date: Fri, 23 Aug 2024 16:25:35 +0800 Message-Id: <20240823082535.3419187-1-yanzhen@vivo.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: TYAPR04CA0006.apcprd04.prod.outlook.com (2603:1096:404:15::18) To KL1PR0601MB4113.apcprd06.prod.outlook.com (2603:1096:820:31::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: KL1PR0601MB4113:EE_|TYUPR06MB6149:EE_ X-MS-Office365-Filtering-Correlation-Id: 1ba64441-9788-4e5d-7f29-08dcc34d4514 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|376014|52116014|38350700014; X-Microsoft-Antispam-Message-Info: Wt17Ey9xVpAMzSB1z4NVYN2S0k9NJZK9iWylJm7cQS7PdYD2rrrIsM0wZqyus0BpWCEEUeHG+Itpzl4rCHlLWB9k+kPMB9UXf2mnezXT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fX2oA9GC6/kYCHsF9l0iP6Q/B8k93Cp4yqZwyzfnmMiueBV3b9vyknsEc2pTeuwCLeYu1abkfHJw6BTv1UYiXXxMLTxgIQ5m6NLMwHwNt3Vcc8Z+tKAJDwy/5xBTLnoqAnsCCeVvQiNAu2qupuYYZyXpkhO7OWEe4TUqf/j9drDL6ZqPWKxHKjXWHLtD6lZMKLNOdQiqKPyq1ge9hUYdwz3uMAKBmsgxOcZRjsWA83RKIbTWdjHMyNzQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:KL1PR0601MB4113.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(1800799024)(376014)(52116014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: eKKTa9a84Grk2rIa7yZPhwvsUv86oJePgI0qlpaN+V0pBPXGQRpm+QYyg6gxbQb1xy9iibvsqncHhQai3RraPU73U5xhJNnenc9zHDFIFcxgrvEOvk2BF/3d3KY0una+6qZEwd8fkKlc1nGlMJ7wzyq/X0j69mePWr9Pw8aW7Ja7HQjyG4aZbGoZI1rFVsBfGycR0lAUn2YDeglrUpQENC+eAU0inWJ7PwGt+zuRNwA3wLkqi0Nw/3KzOEsp4o79bq+C5FsPI6f3WR/0gLD+tFvM19Gcq5lo/pUZNOVDKRDVchXDeNhsAI7mFphEiRXx2UGh4NXvB2/p6mceQAj+tAkV7vwMrkCpMqPPYRe2Js7ih55jmhQH12haFyXPH7FNXb3vxxIIfPTWQk0uEwxdrP/gBd1R+WYO/USzL75siuDzvPTcTd2FV0TzFR34BFXl2zmqp2Til1z2fEF6NSEypEMDKn8gK7mLaKDF52455Wyo9llM62HxL31IjFPgML+uNqZ8cq0wAlyuG+dRb4lrx3Lo/HDtf8baaU6yMAMbJk0fQA5CAVv5xPAg2oKXMl5qbp3nBxKup2wWxxUx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d-7f29-08dcc34d4514 X-MS-Exchange-CrossTenant-AuthSource: KL1PR0601MB4113.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Aug 2024 08:26:22.1195 (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: fjrAZducrrHsliJsG2czl9+ruyH1+3SXOBAD4uwm6+kIwZAuZmm16UPGhDTEH04Xww+tDwfQ64r6RS2qiaMWrA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYUPR06MB6149 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240823_012631_795373_B5BC3D9D X-CRM114-Status: GOOD ( 10.76 ) X-Spam-Score: -2.1 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: When we are allocating an array, using kmemdup_array() is more appropriate and makes auditing the code easier. Signed-off-by: Yan Zhen --- drivers/mtd/mtdconcat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Content analysis details: (-2.1 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.0 ARC_SIGNED Message has a ARC signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 0.0 ARC_VALID Message has a valid ARC signature -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.0 T_SCC_BODY_TEXT_LINE No description available. X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org When we are allocating an array, using kmemdup_array() is more appropriate and makes auditing the code easier. Signed-off-by: Yan Zhen --- drivers/mtd/mtdconcat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/mtdconcat.c b/drivers/mtd/mtdconcat.c index 193428de6a4b..f56f44aa8625 100644 --- a/drivers/mtd/mtdconcat.c +++ b/drivers/mtd/mtdconcat.c @@ -204,7 +204,7 @@ concat_writev(struct mtd_info *mtd, const struct kvec *vecs, } /* make a copy of vecs */ - vecs_copy = kmemdup(vecs, sizeof(struct kvec) * count, GFP_KERNEL); + vecs_copy = kmemdup_array(vecs, count, sizeof(struct kvec), GFP_KERNEL); if (!vecs_copy) return -ENOMEM;