All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alyssa Rosenzweig <alyssa@rosenzweig.io>
To: Wan Jiabing <wanjiabing@vivo.com>
Cc: linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org,
	kael_w@yeah.net, Will Deacon <will@kernel.org>
Subject: Re: [PATCH] iommu/dart: use kmemdup instead of kzalloc and memcpy
Date: Wed, 13 Oct 2021 08:51:04 -0400	[thread overview]
Message-ID: <YWbWOMlMtx3h32Ei@sunset> (raw)
In-Reply-To: <20211013063441.29888-1-wanjiabing@vivo.com>

Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>

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 <wanjiabing@vivo.com>
> ---
>  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
> 
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

WARNING: multiple messages have this Message-ID (diff)
From: Alyssa Rosenzweig <alyssa@rosenzweig.io>
To: Wan Jiabing <wanjiabing@vivo.com>
Cc: Sven Peter <sven@svenpeter.dev>, Joerg Roedel <joro@8bytes.org>,
	Will Deacon <will@kernel.org>,
	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
Date: Wed, 13 Oct 2021 08:51:04 -0400	[thread overview]
Message-ID: <YWbWOMlMtx3h32Ei@sunset> (raw)
In-Reply-To: <20211013063441.29888-1-wanjiabing@vivo.com>

Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>

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 <wanjiabing@vivo.com>
> ---
>  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
> 

  reply	other threads:[~2021-10-13 13:19 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-13  6:34 [PATCH] iommu/dart: use kmemdup instead of kzalloc and memcpy Wan Jiabing via iommu
2021-10-13  6:34 ` Wan Jiabing
2021-10-13 12:51 ` Alyssa Rosenzweig [this message]
2021-10-13 12:51   ` Alyssa Rosenzweig
2021-10-16 14:27 ` Sven Peter via iommu
2021-10-16 14:27   ` Sven Peter
2021-10-18 11:36 ` Joerg Roedel
2021-10-18 11:36   ` Joerg Roedel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YWbWOMlMtx3h32Ei@sunset \
    --to=alyssa@rosenzweig.io \
    --cc=iommu@lists.linux-foundation.org \
    --cc=kael_w@yeah.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=wanjiabing@vivo.com \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.