lkml.org 
[lkml]   [2019]   [Sep]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 4.19 105/190] drm: add __user attribute to ptr_to_compat()
    Date
    [ Upstream commit e552f0851070fe4975d610a99910be4e9bf5d7bd ]

    The ptr_to_compat() call takes a "void __user *", so cast
    the compat drm calls that use it to avoid the following
    warnings from sparse:

    drivers/gpu/drm/drm_ioc32.c:188:39: warning: incorrect type in argument 1 (different address spaces)
    drivers/gpu/drm/drm_ioc32.c:188:39: expected void [noderef] <asn:1>*uptr
    drivers/gpu/drm/drm_ioc32.c:188:39: got void *[addressable] [assigned] handle
    drivers/gpu/drm/drm_ioc32.c:529:41: warning: incorrect type in argument 1 (different address spaces)
    drivers/gpu/drm/drm_ioc32.c:529:41: expected void [noderef] <asn:1>*uptr
    drivers/gpu/drm/drm_ioc32.c:529:41: got void *[addressable] [assigned] handle

    Cc: stable@vger.kernel.org
    Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
    Signed-off-by: Sean Paul <seanpaul@chromium.org>
    Link: https://patchwork.freedesktop.org/patch/msgid/20190301120046.26961-1-ben.dooks@codethink.co.uk
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    drivers/gpu/drm/drm_ioc32.c | 6 +++---
    1 file changed, 3 insertions(+), 3 deletions(-)

    diff --git a/drivers/gpu/drm/drm_ioc32.c b/drivers/gpu/drm/drm_ioc32.c
    index 138680b37c709..f8672238d444b 100644
    --- a/drivers/gpu/drm/drm_ioc32.c
    +++ b/drivers/gpu/drm/drm_ioc32.c
    @@ -185,7 +185,7 @@ static int compat_drm_getmap(struct file *file, unsigned int cmd,
    m32.size = map.size;
    m32.type = map.type;
    m32.flags = map.flags;
    - m32.handle = ptr_to_compat(map.handle);
    + m32.handle = ptr_to_compat((void __user *)map.handle);
    m32.mtrr = map.mtrr;
    if (copy_to_user(argp, &m32, sizeof(m32)))
    return -EFAULT;
    @@ -216,7 +216,7 @@ static int compat_drm_addmap(struct file *file, unsigned int cmd,

    m32.offset = map.offset;
    m32.mtrr = map.mtrr;
    - m32.handle = ptr_to_compat(map.handle);
    + m32.handle = ptr_to_compat((void __user *)map.handle);
    if (map.handle != compat_ptr(m32.handle))
    pr_err_ratelimited("compat_drm_addmap truncated handle %p for type %d offset %x\n",
    map.handle, m32.type, m32.offset);
    @@ -529,7 +529,7 @@ static int compat_drm_getsareactx(struct file *file, unsigned int cmd,
    if (err)
    return err;

    - req32.handle = ptr_to_compat(req.handle);
    + req32.handle = ptr_to_compat((void __user *)req.handle);
    if (copy_to_user(argp, &req32, sizeof(req32)))
    return -EFAULT;

    --
    2.20.1


    \
     
     \ /
      Last update: 2019-09-13 15:31    [W:4.089 / U:0.592 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site