From: Chen Haonan Date: Tue, 9 Jan 2024 06:24:11 +0000 (+0800) Subject: drm/nouveau/disp: switch to use kmemdup() helper X-Git-Tag: v6.9-rc1~126^2~24^2~7 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=632ca3c92f3840d91ba7ddda0271f84813036a11;p=thirdparty%2Flinux.git drm/nouveau/disp: switch to use kmemdup() helper Use kmemdup() helper instead of open-coding to simplify the code. Signed-off-by: Chen Haonan Reviewed-by: Yang Guang Reviewed-by: Kees Cook Signed-off-by: Danilo Krummrich Link: https://patchwork.freedesktop.org/patch/msgid/202401091424115185126@zte.com.cn --- diff --git a/drivers/gpu/drm/nouveau/nvif/outp.c b/drivers/gpu/drm/nouveau/nvif/outp.c index 5d3190c05250a..6daeb7f0b09b6 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);