Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3451615pxb; Wed, 13 Oct 2021 06:22:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzoawEobV0KEnw6o+2vW7lg3CH/cunXqKoMz6w1mFHEn/f47rllJBOKM/aJSdmcFtAsbrar X-Received: by 2002:a17:907:75e1:: with SMTP id jz1mr41829155ejc.439.1634131340329; Wed, 13 Oct 2021 06:22:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634131340; cv=none; d=google.com; s=arc-20160816; b=V6NGEp3HbVPrakxLWOm8EC+Z9p8aWtc54HuVsTUBJDuojdi3KEU9+VJxACPvgDdVVG fh8LsNHyNBkpo7gzdWERsyGewYJBdf03Q8oXLjbb3dSN3eHxtqEfSS9Sn7B9jfxs5jmu Isi2m+BowiEIQkMuD8y9FGQE/45Sr20Rj9Ar+YKM8YrHhBzGMUuwzHpNymP016OkSlZN WjrS0kfAnYGfPO5OpM9PixVbV1hTd1Wta8p6AIvnPikC8iyWZHNz/I4B2Jr1kthpXLO+ TJwnMKu5kQYNhgoLSmGhbmdedBxg5dJ/7m37gGsfsE1EsOEmYwh0BSiqEsyB9kV5B17U ekNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=BCNMx57dCxsojWdbVKEshfqkAYUWNvE3goFpZ1ptVlY=; b=giQv/GBiNBvxtA/1+Bu2xHSJjCApbRtlZnSCQOFK+P9091DP9vpaDaZtzOn6vzNqDr lZ9Y2VNOG6owmP9woD7wtDXWgE59ko68e6CC4SMA45DYRCGQmIm5ijDev9NpMVON7n3P ym0OCV8oylIwUGq9WEK9IBvadqW7/MsYAL+EC+hn5+IOR0drNj5zPNht2PKKJBZ6rSLM DUdzpbZBV38/zo9iNmZYhbR7RdJ0JFv9/hddlvdL9uoYywB7HgNTNgab0IvT/d8lV3rD dyX5sc8AZEOxlo9buHPuvUM4Nspep1hRg3T9if3c/6wNvQR67P7DsIADy2+4Plp2oXeS ko9A== ARC-Authentication-Results: i=1; mx.google.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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e8si20009126ejh.79.2021.10.13.06.21.48; Wed, 13 Oct 2021 06:22:20 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231372AbhJMNVm (ORCPT + 99 others); Wed, 13 Oct 2021 09:21:42 -0400 Received: from rosenzweig.io ([138.197.143.207]:46934 "EHLO rosenzweig.io" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229535AbhJMNVl (ORCPT ); Wed, 13 Oct 2021 09:21:41 -0400 Date: Wed, 13 Oct 2021 08:51:04 -0400 From: Alyssa Rosenzweig To: Wan Jiabing Cc: Sven Peter , Joerg Roedel , Will Deacon , iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, kael_w@yeah.net Subject: Re: [PATCH] iommu/dart: use kmemdup instead of kzalloc and memcpy Message-ID: References: <20211013063441.29888-1-wanjiabing@vivo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211013063441.29888-1-wanjiabing@vivo.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Reviewed-by: Alyssa Rosenzweig On Wed, Oct 13, 2021 at 02:34:41AM -0400, Wan Jiabing wrote: > 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 >