Re: [PATCH v10 2/3] kernel.h: add u64_to_user_ptr()

From: Joe Perches
Date: Fri Mar 18 2016 - 11:39:40 EST


On Fri, 2016-03-18 at 10:27 -0300, Gustavo Padovan wrote:
> From: Gustavo Padovan <gustavo.padovan@xxxxxxxxxxxxxxx>
>
> This function had copies in 3 different files. Unify them in
> kernel.h.

This function might be used more in drm files
in a separate patch too:

$ git grep -n -E "__user.*\(\s*uintptr_t\s*\)" drivers/gpu/drm
drivers/gpu/drm/armada/armada_gem.c:385:        ptr = (char __user *)(uintptr_t)args->ptr;
drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c:33:        return (void __user *)(uintptr_t)address;
drivers/gpu/drm/i915/i915_drv.h:3581:   return (void __user *)(uintptr_t)address;
drivers/gpu/drm/msm/msm_gem_submit.c:33:        return (void __user *)(uintptr_t)address;
drivers/gpu/drm/nouveau/nouveau_gem.c:471:                              (void __force __user *)(uintptr_t)user_pbbo_ptr;
drivers/gpu/drm/nouveau/nouveau_gem.c:568:      void __user *userptr = (void __force __user *)(uintptr_t)user;
drivers/gpu/drm/tegra/drm.c:333:                (void __user *)(uintptr_t)args->cmdbufs;
drivers/gpu/drm/tegra/drm.c:335:                (void __user *)(uintptr_t)args->relocs;
drivers/gpu/drm/tegra/drm.c:337:                (void __user *)(uintptr_t)args->waitchks;
drivers/gpu/drm/tegra/drm.c:392:        if (copy_from_user(&syncpt, (void __user *)(uintptr_t)args->syncpts,
drivers/gpu/drm/vc4/vc4_bo.c:502:                            (void __user *)(uintptr_t)args->data,
drivers/gpu/drm/vc4/vc4_gem.c:123:      if (copy_to_user((void __user *)(uintptr_t)get_state->bo,
drivers/gpu/drm/vc4/vc4_gem.c:553:                           (void __user *)(uintptr_t)args->bo_handles,
drivers/gpu/drm/vc4/vc4_gem.c:627:                         (void __user *)(uintptr_t)args->bin_cl,
drivers/gpu/drm/vc4/vc4_gem.c:634:                         (void __user *)(uintptr_t)args->shader_rec,
drivers/gpu/drm/vc4/vc4_gem.c:641:                         (void __user *)(uintptr_t)args->uniforms,
drivers/gpu/drm/virtio/virtgpu_ioctl.c:126:             user_bo_handles = (void __user *)(uintptr_t)exbuf->bo_handles;
drivers/gpu/drm/virtio/virtgpu_ioctl.c:161:     if (copy_from_user(buf, (void __user *)(uintptr_t)exbuf->command,