diff options
author | Pan Bian <bianpan2016@163.com> | 2016-12-01 09:10:42 +0100 |
---|---|---|
committer | Oded Gabbay <oded.gabbay@gmail.com> | 2017-01-16 16:34:47 +0100 |
commit | 8bf793883da213864efc50c274d2b38ec0ca58b2 (patch) | |
tree | 560ed3fb65402f7d379d664b7f8422327bddf385 /drivers/gpu/drm/amd/amdkfd | |
parent | amdkfd: fix spelling mistake in kfd_ioctl_dbg_unrgesiter (diff) | |
download | linux-8bf793883da213864efc50c274d2b38ec0ca58b2.tar.xz linux-8bf793883da213864efc50c274d2b38ec0ca58b2.zip |
drm/amdkfd: fix improper return value on error
In function kfd_wait_on_events(), when the call to copy_from_user()
fails, the value of return variable ret is 0. 0 indicates success, which
is inconsistent with the execution status. This patch fixes the bug by
assigning "-EFAULT" to ret when copy_from_user() returns an unexpected
value.
Signed-off-by: Pan Bian <bianpan2016@163.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdkfd')
-rw-r--r-- | drivers/gpu/drm/amd/amdkfd/kfd_events.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_events.c b/drivers/gpu/drm/amd/amdkfd/kfd_events.c index a6a4b2b1c0d9..6a3470f84998 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_events.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_events.c @@ -739,8 +739,10 @@ int kfd_wait_on_events(struct kfd_process *p, struct kfd_event_data event_data; if (copy_from_user(&event_data, &events[i], - sizeof(struct kfd_event_data))) + sizeof(struct kfd_event_data))) { + ret = -EFAULT; goto fail; + } ret = init_event_waiter(p, &event_waiters[i], event_data.event_id, i); |