drm/nouveau/disp: switch to use kmemdup() helper
Subsystems (3)
PATCH 1/1 drm/nouveau/disp: switch to use kmemdup() helper
From: Yang Guang <[email protected]>
Use kmemdup() helper instead of open-coding to
simplify the code.
Signed-off-by Chen Haonan <[email protected]>
--- drivers/gpu/drm/nouveau/nvif/outp.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/nouveau/nvif/outp.c +1 -2
@@ -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);
Signature · 1 line
2.25.1
Quoted 6 lines · On Thu, Dec 14, 2023 at 08:03:22PM +0800, [email protected] wrote:
From: Yang Guang <[email protected]>
Use
kmemdup()helper instead of open-coding to
simplify the code.Signed-off-by Chen Haonan <[email protected]>
Sure, good cleanup.
Reviewed-by Kees Cook <[email protected]>
Signature · 1 line
Kees Cook
Hi Yang,
Quoted 6 lines · On 12/14/23 13:03, [email protected] wrote:
From: Yang Guang <[email protected]>
Use
kmemdup()helper instead of open-coding to
simplify the code.Signed-off-by Chen Haonan <[email protected]>
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
Quoted 23 lines
--- drivers/gpu/drm/nouveau/nvif/outp.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/gpu/drm/nouveau/nvif/outp.c +1
-2@@ -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);