public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH linux-next] drm/nouveau/disp: switch to use kmemdup() helper
@ 2023-12-14 11:55 yang.guang5
  0 siblings, 0 replies; 4+ messages in thread
From: yang.guang5 @ 2023-12-14 11:55 UTC (permalink / raw)
  To: lee; +Cc: jiang.xuexin, chen.haonan2, cgel.zte, patches, linux-kernel

From: Yang Guang <yang.guang5@zte.com.cn>

Use kmemdup() helper instead of open-coding to
simplify the code.

Signed-off-by: Chen Haonan <chen.haonan2@zte.com.cn>
---
 drivers/gpu/drm/nouveau/nvif/outp.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nvif/outp.c b/drivers/gpu/drm/nouveau/nvif/outp.c
index 5d3190c05250..6daeb7f0b09b 100644
--- a/drivers/gpu/drm/nouveau/nvif/outp.c
+++ b/drivers/gpu/drm/nouveau/nvif/outp.c
@@ -452,13 +452,12 @@ nvif_outp_edid_get(struct nvif_outp *outp, u8 **pedid)
 	if (ret)
 		goto done;

-	*pedid = kmalloc(args->size, GFP_KERNEL);
+	*pedid = kmemdup(args->data, args->size, GFP_KERNEL);
 	if (!*pedid) {
 		ret = -ENOMEM;
 		goto done;
 	}

-	memcpy(*pedid, args->data, args->size);
 	ret = args->size;
 done:
 	kfree(args);
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH linux-next] drm/nouveau/disp: switch to use kmemdup() helper
@ 2023-12-14 12:03 yang.guang5
  2023-12-14 16:20 ` Kees Cook
  2024-01-08 17:18 ` Danilo Krummrich
  0 siblings, 2 replies; 4+ messages in thread
From: yang.guang5 @ 2023-12-14 12:03 UTC (permalink / raw)
  To: kherbst
  Cc: jiang.xuexin, chen.haonan2, cgel.zte, lyude, dakr, airlied,
	daniel, bskeggs, keescook, dri-devel, nouveau, linux-kernel

From: Yang Guang <yang.guang5@zte.com.cn>

Use kmemdup() helper instead of open-coding to
simplify the code.

Signed-off-by: Chen Haonan <chen.haonan2@zte.com.cn>
---
 drivers/gpu/drm/nouveau/nvif/outp.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nvif/outp.c b/drivers/gpu/drm/nouveau/nvif/outp.c
index 5d3190c05250..6daeb7f0b09b 100644
--- a/drivers/gpu/drm/nouveau/nvif/outp.c
+++ b/drivers/gpu/drm/nouveau/nvif/outp.c
@@ -452,13 +452,12 @@ nvif_outp_edid_get(struct nvif_outp *outp, u8 **pedid)
 	if (ret)
 		goto done;

-	*pedid = kmalloc(args->size, GFP_KERNEL);
+	*pedid = kmemdup(args->data, args->size, GFP_KERNEL);
 	if (!*pedid) {
 		ret = -ENOMEM;
 		goto done;
 	}

-	memcpy(*pedid, args->data, args->size);
 	ret = args->size;
 done:
 	kfree(args);
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH linux-next] drm/nouveau/disp: switch to use kmemdup() helper
  2023-12-14 12:03 [PATCH linux-next] drm/nouveau/disp: switch to use kmemdup() helper yang.guang5
@ 2023-12-14 16:20 ` Kees Cook
  2024-01-08 17:18 ` Danilo Krummrich
  1 sibling, 0 replies; 4+ messages in thread
From: Kees Cook @ 2023-12-14 16:20 UTC (permalink / raw)
  To: yang.guang5
  Cc: kherbst, jiang.xuexin, chen.haonan2, cgel.zte, lyude, dakr,
	airlied, daniel, bskeggs, dri-devel, nouveau, linux-kernel

On Thu, Dec 14, 2023 at 08:03:22PM +0800, yang.guang5@zte.com.cn wrote:
> From: Yang Guang <yang.guang5@zte.com.cn>
> 
> Use kmemdup() helper instead of open-coding to
> simplify the code.
> 
> Signed-off-by: Chen Haonan <chen.haonan2@zte.com.cn>

Sure, good cleanup.

Reviewed-by: Kees Cook <keescook@chromium.org>

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH linux-next] drm/nouveau/disp: switch to use kmemdup() helper
  2023-12-14 12:03 [PATCH linux-next] drm/nouveau/disp: switch to use kmemdup() helper yang.guang5
  2023-12-14 16:20 ` Kees Cook
@ 2024-01-08 17:18 ` Danilo Krummrich
  1 sibling, 0 replies; 4+ messages in thread
From: Danilo Krummrich @ 2024-01-08 17:18 UTC (permalink / raw)
  To: yang.guang5
  Cc: jiang.xuexin, chen.haonan2, cgel.zte, lyude, airlied, daniel,
	bskeggs, keescook, dri-devel, nouveau, linux-kernel, kherbst

Hi Yang,

On 12/14/23 13:03, yang.guang5@zte.com.cn wrote:
> From: Yang Guang <yang.guang5@zte.com.cn>
> 
> Use kmemdup() helper instead of open-coding to
> simplify the code.
> 
> Signed-off-by: Chen Haonan <chen.haonan2@zte.com.cn>

Please add your "Signed-off-by" tag to this patch. If the above is intended to indicate
that Chan was involved in creating this patch (e.g. as co-author, reporter, etc.) please
use the corresponding tag instead. See also [1].

Once this is fixed, I'll apply the patch.

- Danilo

[1] https://www.kernel.org/doc/html/v4.17/process/submitting-patches.html#sign-your-work-the-developer-s-certificate-of-origin

> ---
>   drivers/gpu/drm/nouveau/nvif/outp.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/nouveau/nvif/outp.c b/drivers/gpu/drm/nouveau/nvif/outp.c
> index 5d3190c05250..6daeb7f0b09b 100644
> --- a/drivers/gpu/drm/nouveau/nvif/outp.c
> +++ b/drivers/gpu/drm/nouveau/nvif/outp.c
> @@ -452,13 +452,12 @@ nvif_outp_edid_get(struct nvif_outp *outp, u8 **pedid)
>   	if (ret)
>   		goto done;
> 
> -	*pedid = kmalloc(args->size, GFP_KERNEL);
> +	*pedid = kmemdup(args->data, args->size, GFP_KERNEL);
>   	if (!*pedid) {
>   		ret = -ENOMEM;
>   		goto done;
>   	}
> 
> -	memcpy(*pedid, args->data, args->size);
>   	ret = args->size;
>   done:
>   	kfree(args);


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-01-08 17:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-14 12:03 [PATCH linux-next] drm/nouveau/disp: switch to use kmemdup() helper yang.guang5
2023-12-14 16:20 ` Kees Cook
2024-01-08 17:18 ` Danilo Krummrich
  -- strict thread matches above, loose matches on Subject: below --
2023-12-14 11:55 yang.guang5

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox