amdkfd: Copy from the proper user command pointer
authorBorislav Petkov <bp@suse.de>
Fri, 15 Jan 2016 18:26:44 +0000 (19:26 +0100)
committerAl Viro <viro@zeniv.linux.org.uk>
Fri, 15 Jan 2016 20:14:17 +0000 (15:14 -0500)
8f1d57c17248 ("amdkfd: don't open-code memdup_user()") mistakenly uses
an uninitialized local pointer, gcc complains:

  drivers/gpu/drm/amd/amdkfd/kfd_chardev.c: In function ‘kfd_ioctl_dbg_address_watch’:
  drivers/gpu/drm/amd/amdkfd/kfd_chardev.c:562:12: warning: ‘args_buff’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    args_buff = memdup_user(args_buff,
                ^

Fix it.

Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c

index d321222fd92ef0a1cbc0fda0110da1f8230d9d39..d2b49c026cf685a92dbb57b203f5ecdc04cfb653 100644 (file)
@@ -558,8 +558,7 @@ static int kfd_ioctl_dbg_address_watch(struct file *filep,
                return -EINVAL;
 
        /* this is the actual buffer to work with */
-
-       args_buff = memdup_user(args_buff,
+       args_buff = memdup_user(cmd_from_user,
                                args->buf_size_in_bytes - sizeof(*args));
        if (IS_ERR(args_buff))
                return PTR_ERR(args_buff);