From patchwork Tue Aug 20 07:45:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yu Jiaoliang X-Patchwork-Id: 13770598 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9AC46C5321D for ; Tue, 20 Aug 2024 21:51:12 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C375A10E4F0; Tue, 20 Aug 2024 21:51:11 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=vivo.com header.i=@vivo.com header.b="PTvVuPI9"; dkim-atps=neutral Received: from HK2PR02CU002.outbound.protection.outlook.com (mail-eastasiaazon11010020.outbound.protection.outlook.com [52.101.128.20]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8B27010E347; Tue, 20 Aug 2024 07:45:39 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=hF7+oJahegZZE8c8v3PxwB2+4EJfh5HzKoZLpkCsd2srtqyz0Zf9ag6CNDrKGnemgHUSv7CcI/daPYyLCuY2FDD8rIyxJc+Gu5BiOfTIQj1C6SKfr8NtmmMcpj5s7XEHEBXXAZAmFZ7hoNyE3nYN54cg/6EtfNSk1u4FE25IGE2qOHYkdpPR8mdFu4/2KOESGMAYqc6S5XB7XLAqDDL2CFGfynmGuCPA1/8qXriCUbg4Zy8MeOJRQYkrbDC+dbkD8u5/dW79rm0qtXOW/xqO8unwGkiFd0bYqsozHR/8nqBtWkZi6kausHtzWbzuOhWtE/+z/czeu2MWrHmJiqjZnA== 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=/WYKUntMzzHqoGFvtgriQrKhijQT41q+9OCpPuKfpF4=; b=eCgvWmAXIJ8kHTwSwgBaR7dM2ZxP9T6Mk6ldeAEzo4Ncmikr/1aphaG9ldACmd3PrdMM5aEg3+GOeoP3d9XnORpwRhjvDVfET0tQiKMDQSqtYd+nEcZiwk86ErBfzFwCAOAo6/dR7eejsYQMocQSorbnGUV3tZs+hxa5QCclU+YTd4FE5ya4Bn0MRUsKhyY9fCMXQKP42orTyxJ/Y88f6potK/fYoTgeAHKnYqjC6YYmF/surbKogZkTrWKpeqAuKWugtbZxhcXmdaqK0YrgoPknRnEDnkS0LE/6ezhlqY99AnYibywrHck2Qa1aNKKPJubN1QVjWenvJsavpqi71A== 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=/WYKUntMzzHqoGFvtgriQrKhijQT41q+9OCpPuKfpF4=; b=PTvVuPI9+dfih7DaVDcFDWW5fhsfOC0l0CUKh5h8/Aol0ksHwpG2VE3T/cI/P2p4oCuC3mb5W1KHkoFEzXgSQ/hwtTOBBCfwKbA3HRv9pGD5Efac3MjV4bX+gdXTc8JQpu4JR/qJDtCRHVUWCZlvgohCLGRy+yNBecY2gXFuG172TI6vOm3L93jc/lJ7sIkTnZFqwbrT9oRNgM5or8YrD6IcpmIi1tcqvW6xQKaHXcVeqLctusxFhrEB6/HDIaXM9fz/8lh1oTV42TWnYqsXFxc1HRoKkhIGN6EG0GYx6Q26A/HoV6VrzVB6aaTm15BlHaEWJdsav9QCOvNHBlUXRA== 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 TYZPR06MB7117.apcprd06.prod.outlook.com (2603:1096:405:b6::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.21; Tue, 20 Aug 2024 07:45:35 +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; Tue, 20 Aug 2024 07:45:35 +0000 From: Yu Jiaoliang To: Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Daniel Vetter , Matt Roper , Andi Shyti , Michal Mrozek , Gustavo Sousa , Lucas De Marchi , Tejas Upadhyay , Shekhar Chauhan , intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Cc: opensource.kernel@vivo.com, Yu Jiaoliang Subject: [PATCH v1] drivers:gt:Switch to use kmemdup_array() Date: Tue, 20 Aug 2024 15:45:03 +0800 Message-Id: <20240820074505.2728118-1-yujiaoliang@vivo.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: TYCPR01CA0057.jpnprd01.prod.outlook.com (2603:1096:405:2::21) To TYZPR06MB4461.apcprd06.prod.outlook.com (2603:1096:400:82::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYZPR06MB4461:EE_|TYZPR06MB7117:EE_ X-MS-Office365-Filtering-Correlation-Id: 77cdd5d9-742e-4c1f-d5a2-08dcc0ec13a1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|52116014|1800799024|7416014|366016|921020|38350700014; X-Microsoft-Antispam-Message-Info: zfFOllisly0Pke3Hfj9T7z2blbM5lvKtqsKXUppIC153yqOdbmREaXKXKEq/S9ZffR4wkYLyo2iq5vIGCDh2+YpcngPxcl1TRYX7eDdJnXnxL+6LXTyGxZyi+hyEspNG43DNBquFXe1zY9UyJMM8WKZFCoG/s2MF23rz+CtEDkUa7m8+z1PH1lQQIkxZfv9E3E3PZPLmsgTISNRXjjL8pKnLruC/BdO2MJYzBTk9Wr06/F5FvztAHb2Uobz8jwOqfTcwr7ASJsnz5SOvJnpIk+aFzRSV/H8QjRg2lrYOv9PuRqJuvtQSB5TxkNH+eCW9i0RJr52gwUIBEawHWHQo+Roo/PdHN3cxfORTNHE2BeCA20XQ6mb6F8dXjJbVN0Lzul3Uei8I+27ABZ2kHnrQEYeg6bHfJtwdsiE7IL4aMhrX+oanBVx13Y47/QEk88h/uqnB3WFvA4t1BZuSugg1AAsmW4yzTWXpW2St/AyYGz4D3JYCrTG0rw7j8ObC5jDDPmv5rAFFbdYUTtMjHu4CcYIjbD15VI9A7KxMQpVkn6S9KgD+4KWblMhZ27sSvRPy1vRmi9qumYEGCRcEKRBoNmjfdHbeWJlOPhrnJ5jlSamku0RvMT6EAVfI5Hs8HZeDL6v1Ysjm57tRNNle4tRdn+JjXiJrlO9oxJ9EotmTx0UyJCvg9jS9w401UJ9ihWdM8DN57xULvBLfyqnFGucFd2pkWKT023W29IKboS+5Ok5+CmWEYxD1EOaI6sn8I7wmVvmOEnCrLgkX7r2qwkfRY/KHNf7LAI0aYLgDeKPOM3Pb+YlkBoMpWlT46/34+jcsGJrx2/qArp7XTegokVPrdv/xNoJq18mSiGWikM1FY3J/Xmc+qbHluXR5KN8aopqelFTKLdkobznaNBunGDeNg3BnmUCUuECep5ZDG3PXTWDTM+KpMR1bpu1PHuf7rgFXJYRBHlEXmOBc2okQYCttA3fRPoU+uTn4+cw7t3OavV04iKWE1ZbHB+18UsuMty+D7URf9R1TQJaSJW54d2w4dBDdD0ryHqBN60wJvaWcHQdJDHXpkTmjyc9Ia8lcaolE6yRTWrfToW39rJUFhwXpL0Vl5mMDzWv1Ccb8lPCWjPEWAQN+FsSF/xsJ177UeZkQV0qwXHTGROq9fWvRtyYEul3Xo+yi7vOMRG0hMIVYaFrTCve0tP+AF0CzrBS1gkDhEw5yIToiVimi5qVJdVSK0/yLXutexhToI8XNvNX9U7jZIHQum+BAcrIKCYP/j6ufTg2apYHLxPggTmzdS/KmiN8GUh6Tcf/GMC04Ax86MKAuLMwK5wdMnTr9JjqkJzEKsD4woRmGu0qpqeb4XQxeZfQAAi2aOp99uiLWOj78A2VE3zolU5UMkklb4Z7Z5uEDgO+l+4UgJl9yhhVG0nQhYFm7Z+WV3/OfbRU9gXfo2vQ= 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)(376014)(52116014)(1800799024)(7416014)(366016)(921020)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: FjhKaR7znS+Qhcl+RLiTByQNkA7FOYDz34Nzy4VIxDyJ1DP9XBpZMpk5n+B9mfHp/HrrE2/KDjMjPegvqtrpjjO8nYCqJK457QMmpr7ro57PkhmZQe+Ed1wYrNFUgKjc70zIF+WEK0qLblu6OiYrW61KfiL8tlfzzJQD9hipqliM9C83WjM8+JH3J7ClHr4MBHjyfseOe+P/oLBvithwDHcsslseJLPHMe9P5JgdpK3l3bJ/yPfkN63COGk+FtVIsqr5ucndG3LxfKfcU6xEMQ0sO+vafN0a4f/8u94jNaBoGHbOva76jNJaX3HbhnHyXyckpI+IHf89EJy2klCeq9T86Qt2y8F+hRJx1YCe5M12IplliT1vRUXOmBkGv287X2Z/Hdi33TUisD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ZSVo+p+SbnzIV9bdXoCJYzy7jXiCRG/5Ca+pBJLLzsuRs/afApRYEay2i6JMsPE9Q8dAk9a6Io2PQrerJDOYgkSxfGT/s0mgqFR/G9Vv3M2rj6xEGX73+8XA4v X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 77cdd5d9-742e-4c1f-d5a2-08dcc0ec13a1 X-MS-Exchange-CrossTenant-AuthSource: TYZPR06MB4461.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Aug 2024 07:45:35.5501 (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: B8DPz/VeGC19bSiDP135ePcQ/0+d9txw5mvDshHaEWW5E3oCpjSwsJ5+gPmBLrd9nlveMm/EH8Z2/IcJX90r7g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR06MB7117 X-Mailman-Approved-At: Tue, 20 Aug 2024 21:51:09 +0000 X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Let the kememdup_array() take care about multiplication and possible overflows. Signed-off-by: Yu Jiaoliang --- drivers/gpu/drm/i915/gt/intel_workarounds.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/gt/intel_workarounds.c b/drivers/gpu/drm/i915/gt/intel_workarounds.c index 09a287c1aedd..d90348c56765 100644 --- a/drivers/gpu/drm/i915/gt/intel_workarounds.c +++ b/drivers/gpu/drm/i915/gt/intel_workarounds.c @@ -111,8 +111,8 @@ static void wa_init_finish(struct i915_wa_list *wal) { /* Trim unused entries. */ if (!IS_ALIGNED(wal->count, WA_LIST_CHUNK)) { - struct i915_wa *list = kmemdup(wal->list, - wal->count * sizeof(*list), + struct i915_wa *list = kmemdup_array(wal->list, + wal->count, sizeof(*list), GFP_KERNEL); if (list) {