* [PATCH] drm/exynos: vidi: use memdup_user() instead of kmalloc() and copy_from_user()
@ 2026-07-05 11:02 mdshahid03
0 siblings, 0 replies; only message in thread
From: mdshahid03 @ 2026-07-05 11:02 UTC (permalink / raw)
To: Inki Dae, Seung-Woo Kim, Kyungmin Park, David Airlie,
Simona Vetter, Krzysztof Kozlowski, Peter Griffin
Cc: Alim Akhtar, dri-devel, linux-arm-kernel, linux-samsung-soc,
linux-kernel, Mohammad Shahid
From: Mohammad Shahid <mdshahid03@gmail.com>
Use memdup_user() to replace the open-coded kmalloc() and
copy_from_user() sequence.
This simplifies the code while preserving the existing behavior.
This issue was reported by memdup_user.cocci.
Signed-off-by: Mohammad Shahid <mdshahid03@gmail.com>
---
drivers/gpu/drm/exynos/exynos_drm_vidi.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_vidi.c b/drivers/gpu/drm/exynos/exynos_drm_vidi.c
index 67bbf9b8bc0e..183671de711e 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_vidi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_vidi.c
@@ -273,14 +273,9 @@ int vidi_connection_ioctl(struct drm_device *drm_dev, void *data,
size = (hdr.extensions + 1) * EDID_LENGTH;
- edid_buf = kmalloc(size, GFP_KERNEL);
- if (!edid_buf)
- return -ENOMEM;
-
- if (copy_from_user(edid_buf, edid_userptr, size)) {
- kfree(edid_buf);
- return -EFAULT;
- }
+ edid_buf = memdup_user(edid_userptr, size);
+ if (IS_ERR(edid_buf))
+ return PTR_ERR(edid_buf);
drm_edid = drm_edid_alloc(edid_buf, size);
kfree(edid_buf);
--
2.43.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-07-05 11:06 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-05 11:02 [PATCH] drm/exynos: vidi: use memdup_user() instead of kmalloc() and copy_from_user() mdshahid03
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox