diff options
author | Oded Gabbay <oded.gabbay@amd.com> | 2015-01-22 12:42:28 +0100 |
---|---|---|
committer | Oded Gabbay <oded.gabbay@amd.com> | 2015-01-22 16:52:50 +0100 |
commit | 0b3674ae1c8b9539dde694a70391e974aedde8c2 (patch) | |
tree | df8414f2f1632caadecbd9c66abf662f721ce180 /drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | |
parent | drm/amdkfd: Handle case of invalid queue type (diff) | |
download | linux-0b3674ae1c8b9539dde694a70391e974aedde8c2.tar.xz linux-0b3674ae1c8b9539dde694a70391e974aedde8c2.zip |
drm/amdkfd: Fix sparse errors
Signed-off-by: Oded Gabbay <oded.gabbay@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdkfd/kfd_chardev.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c index 732087dcac91..5c50aa8a8908 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c @@ -141,8 +141,6 @@ static int kfd_ioctl_get_version(struct file *filep, struct kfd_process *p, static int set_queue_properties_from_user(struct queue_properties *q_properties, struct kfd_ioctl_create_queue_args *args) { - void *tmp; - if (args->queue_percentage > KFD_MAX_QUEUE_PERCENTAGE) { pr_err("kfd: queue percentage must be between 0 to KFD_MAX_QUEUE_PERCENTAGE\n"); return -EINVAL; @@ -180,16 +178,18 @@ static int set_queue_properties_from_user(struct queue_properties *q_properties, return -EFAULT; } - tmp = (void *)(uintptr_t)args->eop_buffer_address; - if (tmp != NULL && - !access_ok(VERIFY_WRITE, tmp, sizeof(uint32_t))) { + if (args->eop_buffer_address && + !access_ok(VERIFY_WRITE, + (const void __user *) args->eop_buffer_address, + sizeof(uint32_t))) { pr_debug("kfd: can't access eop buffer"); return -EFAULT; } - tmp = (void *)(uintptr_t)args->ctx_save_restore_address; - if (tmp != NULL && - !access_ok(VERIFY_WRITE, tmp, sizeof(uint32_t))) { + if (args->ctx_save_restore_address && + !access_ok(VERIFY_WRITE, + (const void __user *) args->ctx_save_restore_address, + sizeof(uint32_t))) { pr_debug("kfd: can't access ctx save restore buffer"); return -EFAULT; } |