yang.guang5 at zte.com.cn
2023-Dec-14 12:13 UTC
[PATCH linux-next] drm/nouveau/disp: switch to use kmemdup() helper
From: Yang Guang <yang.guang5 at zte.com.cn> Use kmemdup() helper instead of open-coding to simplify the code. Signed-off-by: Chen Haonan <chen.haonan2 at 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
Kees Cook
2023-Dec-14 16:20 UTC
[PATCH linux-next] drm/nouveau/disp: switch to use kmemdup() helper
On Thu, Dec 14, 2023 at 08:03:22PM +0800, yang.guang5 at zte.com.cn wrote:> From: Yang Guang <yang.guang5 at zte.com.cn> > > Use kmemdup() helper instead of open-coding to > simplify the code. > > Signed-off-by: Chen Haonan <chen.haonan2 at zte.com.cn>Sure, good cleanup. Reviewed-by: Kees Cook <keescook at chromium.org> -- Kees Cook
Danilo Krummrich
2024-Jan-08 17:18 UTC
[PATCH linux-next] drm/nouveau/disp: switch to use kmemdup() helper
Hi Yang, On 12/14/23 13:03, yang.guang5 at zte.com.cn wrote:> From: Yang Guang <yang.guang5 at zte.com.cn> > > Use kmemdup() helper instead of open-coding to > simplify the code. > > Signed-off-by: Chen Haonan <chen.haonan2 at 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);
Possibly Parallel Threads
- [PATCH linux-next v2] drm/nouveau/disp: switch to use kmemdup() helper
- [PATCH linux-next v2] drm/nouveau/disp: switch to use kmemdup() helper
- [PATCH linux-next] drm/nouveau/disp: switch to use kmemdup() helper
- [PATCH 05/30] crypto: Use kmemdup rather than duplicating its implementation
- [PATCH v2 06/35] crypto: Use kmemdup rather than duplicating its implementation