Hi Tvrtko,

Em 12/11/2025 06:27, Tvrtko Ursulin escreveu:
Using a helper shrinks the code and separating the user and kernel slabs
is more secure.

As in the commit message, the commit description should be writing in the imperative mood.


Signed-off-by: Tvrtko Ursulin <[email protected]>
---
v2:
  * Remove now unused dev local.
---
  drivers/gpu/drm/drm_gem.c | 13 +++----------
  1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c
index a1a9c828938b..68168d58a7c8 100644
--- a/drivers/gpu/drm/drm_gem.c
+++ b/drivers/gpu/drm/drm_gem.c
@@ -783,7 +783,6 @@ static int objects_lookup(struct drm_file *filp, u32 
*handle, int count,
  int drm_gem_objects_lookup(struct drm_file *filp, void __user *bo_handles,
                           int count, struct drm_gem_object ***objs_out)
  {
-       struct drm_device *dev = filp->minor->dev;
        struct drm_gem_object **objs;
        u32 *handles;
        int ret;
@@ -798,15 +797,9 @@ int drm_gem_objects_lookup(struct drm_file *filp, void 
__user *bo_handles,
*objs_out = objs; - handles = kvmalloc_array(count, sizeof(u32), GFP_KERNEL);
-       if (!handles) {
-               ret = -ENOMEM;
-               goto out;
-       }
-
-       if (copy_from_user(handles, bo_handles, count * sizeof(u32))) {
-               ret = -EFAULT;
-               drm_dbg_core(dev, "Failed to copy in GEM handles\n");

Why the debugged message has been removed?

+       handles = vmemdup_array_user(bo_handles, count, sizeof(u32));
+       if (IS_ERR(handles)) {
+               ret = PTR_ERR(handles);
                goto out;
        }

Reply via email to