Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3164345pxb; Tue, 12 Oct 2021 23:40:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxPmsTYcH8UbvuaIG2iSJkL0kyL68n7/QxZ7+yKYes1SBZPFZzW1F3z00eToCdVerW7owFD X-Received: by 2002:a17:906:c252:: with SMTP id bl18mr37355129ejb.519.1634107214441; Tue, 12 Oct 2021 23:40:14 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1634107214; cv=pass; d=google.com; s=arc-20160816; b=JufCGgjV/IxaDXHSoE6iOisPgWkMQe8dniu/V+Haydwd4s1PTy2ylLcx94L1ICLX/d 1pPVJ2hVJMPkWYbJbWunsV+AFE1E0uMtS6Z/ehg1J03JQXy184NLq//B7cw6EIgcSHu0 BpfjeeZnvz3KPBFXo3r1tGB7UoIufUr5Rcgfbkvv5CnCSNivfxmGAg9V8tyAnNfYtCIZ TIv8+pkvyVM7gU7hc8diMbbqxm+7S7ECK1SgA9KgJbVk2iSBt4S58E8rD9iO4PPRB9w/ fcD+ioflLs9EYfPL/3m9hT5uLBD+Jy7gGJtt5IHU2/u6TkOwzMnkHSC50/h74IzVSMgy eiyw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :message-id:date:subject:cc:to:from:dkim-signature; bh=E8+YTsIiPZpZPPiQUYcAZdnvN18AiNThT10Dt0zzEPo=; b=qK53PPda6DJB/h98obBeXNkyJY2TyRckPpoRKQM9SlNzaADoi4SU7jHY/2Jt2qFJ0B BDWxBOxc1p0m7R3HUQ3fyFxBl1KOnH91zsdmgRFQr+8vO5Er9XPYaXN0Hn/KbTGGibJ9 JEwqyaR11gUcf1hqwBSxYDHTj3lI/MPocEwCuDIm/HDBxilwbpAEZG1YjjRWlZ5sf1w+ pFq2elwZyGM+h79eo3SqYx4PFpeTpNUZNfkUZaUZRWgGY5J5V2mxaGYV/fA2NOnCYrs+ OmuyAiWNA45EXwTHDZGtEb69SyCbGVBarHrQgwTaZv+gu1dlJLoI8A50cyVHOT4Z+pIp XmGw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@vivo0.onmicrosoft.com header.s=selector2-vivo0-onmicrosoft-com header.b=FGph6Apk; arc=pass (i=1 spf=pass spfdomain=vivo.com dkim=pass dkdomain=vivo.com dmarc=pass fromdomain=vivo.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=vivo.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 14si18009037ejf.611.2021.10.12.23.39.51; Tue, 12 Oct 2021 23:40:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@vivo0.onmicrosoft.com header.s=selector2-vivo0-onmicrosoft-com header.b=FGph6Apk; arc=pass (i=1 spf=pass spfdomain=vivo.com dkim=pass dkdomain=vivo.com dmarc=pass fromdomain=vivo.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=vivo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231485AbhJMGh4 (ORCPT + 99 others); Wed, 13 Oct 2021 02:37:56 -0400 Received: from mail-eopbgr1300097.outbound.protection.outlook.com ([40.107.130.97]:58112 "EHLO APC01-HK2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229777AbhJMGhz (ORCPT ); Wed, 13 Oct 2021 02:37:55 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BFGyQDYG2u41GIFQmU4r03J2xGPK9HxfYY/bean3SPWc6CDbhPtCXP9NyuzOMlKl+U1vOe4RtVfj66Z1zaXjNbT72TBi9pryaDltNc+rxs0gE1fjAry3M6pZIvlPtIguyuZdqwUaedKVah74SoHNL57fDOgnQP8mSESec0w99yt2tcHO/D79lLdT3KOAtn/PJ99sGJXr9gY8RfEuMtZc2KvU0QjbC3277B1bdsSxBMzzpHXuwmdTGVLqybY58JWP/pLZkasiVEkKxCUz4k5V713wEMaTprSSfNST4r7i5X01Ar3y1ZPReKGUHb2TmpJo8HcHawCa3peFBpf0fa3lkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=E8+YTsIiPZpZPPiQUYcAZdnvN18AiNThT10Dt0zzEPo=; b=ggwcXtRDC5Q5b4HGDQNql8i5GlBPUIACNAus98qCPhDrZwPOZ17jXwSaXk70nqZR3jz74qa3Fa4MZcvtnvmJCbbioBlWt+BpqMZ2eOawx4POtcMkRTqmbDRdfAoO2QRKQX7OTh6wJxAy5jF4tidIz1EkhK8MIgnCR+GnQ/1dpEjGO7UAE9bqzgluzDLr42NSCRQuvESrUbbGHikQ2rofxGC47lAx7ASKknh++DsfKfnlbcGsXIrQFUoHA75DEP7qLcn1KzHH/sEmn+lV0rNkQZmSS39dIrcFocYaj7ygh8ncqQ8twLeTu6NKm1zp7lJ7VWLBfJ+yxliMr+fnHwoI/w== 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=vivo0.onmicrosoft.com; s=selector2-vivo0-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=E8+YTsIiPZpZPPiQUYcAZdnvN18AiNThT10Dt0zzEPo=; b=FGph6Apkna+kHCsebnLW6p4ck3CWV9aZsbRYpQmOgaxA2EleC9em0g54n98kL/8v5tMOPMZoWYt7/wtAKdKOxMdJ4W5bT3rJ8+CwjqFox53WJ5qz9lN0tRdCwz5KtU+4MCb7cbonR5L7azMelq1GG3WuTY4g5uUHvixK69Sx8X0= Authentication-Results: svenpeter.dev; dkim=none (message not signed) header.d=none;svenpeter.dev; dmarc=none action=none header.from=vivo.com; Received: from SG2PR06MB3367.apcprd06.prod.outlook.com (2603:1096:4:78::19) by SG2PR06MB3047.apcprd06.prod.outlook.com (2603:1096:4:77::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.22; Wed, 13 Oct 2021 06:35:47 +0000 Received: from SG2PR06MB3367.apcprd06.prod.outlook.com ([fe80::fc12:4e1b:cc77:6c0]) by SG2PR06MB3367.apcprd06.prod.outlook.com ([fe80::fc12:4e1b:cc77:6c0%6]) with mapi id 15.20.4608.015; Wed, 13 Oct 2021 06:35:46 +0000 From: Wan Jiabing To: Sven Peter , Alyssa Rosenzweig , Joerg Roedel , Will Deacon , iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org Cc: kael_w@yeah.net, Wan Jiabing Subject: [PATCH] iommu/dart: use kmemdup instead of kzalloc and memcpy Date: Wed, 13 Oct 2021 02:34:41 -0400 Message-Id: <20211013063441.29888-1-wanjiabing@vivo.com> X-Mailer: git-send-email 2.20.1 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: HK2PR04CA0090.apcprd04.prod.outlook.com (2603:1096:202:15::34) To SG2PR06MB3367.apcprd06.prod.outlook.com (2603:1096:4:78::19) MIME-Version: 1.0 Received: from localhost.localdomain (218.213.202.190) by HK2PR04CA0090.apcprd04.prod.outlook.com (2603:1096:202:15::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.15 via Frontend Transport; Wed, 13 Oct 2021 06:35:44 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 65a98f0c-e9a0-45fa-3f81-08d98e13afb3 X-MS-TrafficTypeDiagnostic: SG2PR06MB3047: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1303; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Q5qYgx4xI1ureiHZTgtQwcf4lQPVkHYP1jTBNSGDdEO7B1ar6SskUVBVwL2PmIc6j2qWBtkFSRpNY4VcCY+F7nKJnGBbEkrpi7Ng8cjmvf5bMOHgd+FuOlUYFYjnvY0svAA7h5q6w4NRP9/dhynWbRmL2ov1gQxYJyfS8f152ojcq9k8NG3ZJPEMiDNr9fqh2pQAFcB43DXU7qBo9qUhGb8ymcwMycLGydW/ovq/6Ku+qXLECyP+h/kuE2ChO1C/meW65wBtx/EtecTDjIWZIZ5JdSWB24Vtby6lpaX1fSCStSzA1vlxAAKXiyAglFIjrTVaib9s2i3jBPtrO9feT8xjBFEQNz+G/WhX6nAe+dO2MOrZ34AeoW6LdwsqubdFuDI7VIWtOxycVEJ+gRmODcf8OyHVzXzNKDYs5ox8zp8nx7DafWaZDNWdfjZV6XYrX6Qg7Ypf0VqiB4Thmh7+5ftXKPVQ/4mj0FoZu6oGv9Qc5IguyK9zAceC74t4sKrHrTvvlPG9x21puClacitOftbCZIFX8xm5cc4nad8pQhCgNA/RBuB33o4/hk3K+tJ97TJrIUMT4ELvzvLDfczLG2iewtXnk6xmGYoXNUn+LBY25/1OYU4BU9xCZnJ1L2I7hT9EGWDYaCmOuRTPYct8uNoq8h6s6N6KPwJmLU+yE8CqJqXAloIBQT8e55wd9mu7Nu55y9bjRAtLhRGVcLBvZA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SG2PR06MB3367.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(4744005)(508600001)(4326008)(110136005)(107886003)(38100700002)(66476007)(83380400001)(66946007)(2906002)(66556008)(2616005)(1076003)(956004)(38350700002)(52116002)(5660300002)(6486002)(36756003)(8676002)(6666004)(6506007)(26005)(8936002)(316002)(86362001)(186003)(6512007);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?OryUusFxuAWee4WwT/tC54SipZcjyQ8UQPa8MGkeek7xtRzZKMyvGtGLtvNt?= =?us-ascii?Q?eFSXOHCSl4aBgGDo0QWNYxoCPvr46BI+IgMMEK0SMm1+H6Mkbpb4UAZ2XPIl?= =?us-ascii?Q?GGsKXI1TJmkuQ6EHDcOBGGSZiaKVrsn80CsT/+3ZPjOZtUwp1VJTHLRlz1eB?= =?us-ascii?Q?CHjtqfJKSeNceRpOOTnUSqodPCswGxPB8iqpwvCb8Lh54A8yu8fF6HqxhTTN?= =?us-ascii?Q?lUQAU76N8M7kQXvWuVgvkoXbhlZQVRp+v3vyTk0ekH3OIRRaMqU8913x/NAf?= =?us-ascii?Q?Ne0YctfXs3jsne/BWlmOvZt5Eqmpd2lF9KcfAls9RqnOXDHquAltjzUnYMkM?= =?us-ascii?Q?osOgkcX0T7a3VymWALNdzjAaSyeOkZhyLjDLysqvD+Ihu+xZE+vB0+IFtzQR?= =?us-ascii?Q?g8/irlheWjRJ0U7WzKbwhijVZZ7H+4uKryXXyTREZX5QJHe6uaU1giQL6cQS?= =?us-ascii?Q?xzNjEB7rxo/f2S3H+3C8aGsQy4bFWYh5LYZOHrqW12KrACUVlfDfPh2HnbY5?= =?us-ascii?Q?K0pHwKVmfXiPQmNPD9l0COOsvTgybM+CChu+oUkXcCIQasQ6BHXdrABG7JbT?= =?us-ascii?Q?o5rA7Z8OWcaBZsFkgWfLQAgomvnw/rRqjHhhcvJkKDtCE9vSOuVOnWvQXpYB?= =?us-ascii?Q?w/aXRboosCml9mT/XPsQiZhAeFiXQ00RVFRfff3KcXh8oI+DmmvhG9mb0jS+?= =?us-ascii?Q?M6GfQ/XRLJ/pAriR4pHb0gI96aryr5LTF3nI5XyXoNiYdp9zBtErCZgDvloo?= =?us-ascii?Q?3iWOHS+K+R3EZoUnEu3odaWGhoruqpA5grbp4CEfhAU4eDlME4c7GOUDBQMn?= =?us-ascii?Q?cPpjPEJVeEFmiLQTzRKVfejIM7KMf0CDjWQSj9SpfL0Xkh/tor8E6QH0NtZd?= =?us-ascii?Q?iFZUPfNi2xnX/tjoAcFhYxmI+uKsnBjn4lb5ZEP5HC+8eXFmMc6NCBfBwAOh?= =?us-ascii?Q?O4c06OzHz39N2Vr1+HyTZ1eTmkiDcmuG3XqHlzB5/ogOesFO5+Sa1uTSh9Es?= =?us-ascii?Q?gRf3T6njS4jyIrOALQe9C8S8phNxf2b6mlTG56OXS+I+t729eyqRUmDEenmK?= =?us-ascii?Q?Cf6Nl11UxKvypdA0v1Vg2mxG4+TDvNPOva70vRNZSYY/7euM+EdFnw4n5CoZ?= =?us-ascii?Q?uLZd2tN/i8GdqInRpe2n6bewNOMTTcQLg8FQ6CQO5FaMiWzxGzm2Cx+66RYz?= =?us-ascii?Q?qt9CSi+WRbYvyUt5qb+P5OYp33r09KAb+LKL7XJm3EHAchudcRnP1bi/py9v?= =?us-ascii?Q?R8V1TfKuR181fI9jcwgGia/BoriXgRmXrCma0YhR5ZNHWHE5uJEaJma31VOn?= =?us-ascii?Q?WSxJH415x0LFrF44t3Sf4frW?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 65a98f0c-e9a0-45fa-3f81-08d98e13afb3 X-MS-Exchange-CrossTenant-AuthSource: SG2PR06MB3367.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Oct 2021 06:35:45.7196 (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: nADN7oVvR6ve+weI23ksglTfQzaRLdVvAWIqXfvmHTvlKdEJK/+RvUhcnxTKaIo7A904LLzOT1QGZwT6Nm0p9w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SG2PR06MB3047 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Fix following coccicheck warning: drivers/iommu/apple-dart.c:704:20-27: WARNING opportunity for kmemdup Signed-off-by: Wan Jiabing --- drivers/iommu/apple-dart.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/iommu/apple-dart.c b/drivers/iommu/apple-dart.c index 280ff8df728d..5eeb8d6b72e2 100644 --- a/drivers/iommu/apple-dart.c +++ b/drivers/iommu/apple-dart.c @@ -701,13 +701,12 @@ static struct iommu_group *apple_dart_device_group(struct device *dev) if (!group) goto out; - group_master_cfg = kzalloc(sizeof(*group_master_cfg), GFP_KERNEL); + group_master_cfg = kmemdup(cfg, sizeof(*group_master_cfg), GFP_KERNEL); if (!group_master_cfg) { iommu_group_put(group); goto out; } - memcpy(group_master_cfg, cfg, sizeof(*group_master_cfg)); iommu_group_set_iommudata(group, group_master_cfg, apple_dart_release_group); -- 2.20.1