Skip to contentSkip to conversation

drm: Use array_size() in call to copy_from_user() in drm_mode_dirtyfb_ioctl()

PATCH New Gax-c 1 participant 1 message Nov 15, 2024

Subsystems (2)
lore
Share & tools
lore

Gax-c

author
#0 lore raw

PATCH 1/1 drm: Use array_size() in call to copy_from_user() in drm_mode_dirtyfb_ioctl()

From: Zichen Xie <[email protected]>

Like commit ac19c4c3d02e ("bcachefs: Use array_size() in call to copy_from_user()"), it's a safer way to use helper array_size() in copy_from_user() to avoid potential overflow issues.

Fixes 7520a277d97b ("drm: Extract drm_framebuffer.[hc]")
---
 drivers/gpu/drm/drm_framebuffer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/drm_framebuffer.c +1 -1
index 888aadb6a4ac..323fb194ca17 100644
@@ -752,7 +752,7 @@ int drm_mode_dirtyfb_ioctl(struct drm_device *dev,
 		}
 
 		ret = copy_from_user(clips, clips_ptr,
-				     num_clips * sizeof(*clips));
+				     array_size(num_clips, sizeof(*clips)));
 		if (ret) {
 			ret = -EFAULT;
 			goto out_err2;
Signature · 1 line
2.34.1