* [PATCH -next] drm/amdkfd: Fix the error return code in kfd_ioctl_unmap_memory_from_gpu()
@ 2018-03-30 2:25 Wei Yongjun
2018-04-02 18:02 ` Felix Kuehling
0 siblings, 1 reply; 3+ messages in thread
From: Wei Yongjun @ 2018-03-30 2:25 UTC (permalink / raw)
To: oded.gabbay, alexander.deucher, christian.koenig, David1.Zhou,
airlied, Felix Kuehling
Cc: Wei Yongjun, dri-devel, amd-gfx, linux-kernel, kernel-janitors
Passing NULL pointer to PTR_ERR will result in return value of 0
indicating success which is clearly not what it is intended here.
This patch returns -EINVAL instead.
Fixes: 5ec7e02854b3 ("drm/amdkfd: Add ioctls for GPUVM memory management")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
index cd679cf..c32a341 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
@@ -1421,7 +1421,7 @@ static int kfd_ioctl_unmap_memory_from_gpu(struct file *filep,
pdd = kfd_get_process_device_data(dev, p);
if (!pdd) {
- err = PTR_ERR(pdd);
+ err = -EINVAL;
goto bind_process_to_device_failed;
}
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH -next] drm/amdkfd: Fix the error return code in kfd_ioctl_unmap_memory_from_gpu()
2018-03-30 2:25 [PATCH -next] drm/amdkfd: Fix the error return code in kfd_ioctl_unmap_memory_from_gpu() Wei Yongjun
@ 2018-04-02 18:02 ` Felix Kuehling
2018-04-24 9:16 ` Oded Gabbay
0 siblings, 1 reply; 3+ messages in thread
From: Felix Kuehling @ 2018-04-02 18:02 UTC (permalink / raw)
To: Wei Yongjun, oded.gabbay, alexander.deucher, christian.koenig,
David1.Zhou, airlied
Cc: dri-devel, amd-gfx, linux-kernel, kernel-janitors
Thanks for catching that. I'd use -ENODEV to match what is done a few
lines below for peer_pdd. With that fixed, this patch is Reviewed-by:
Felix Kuehling <Felix.Kuehling@amd.com>
Regards,
Felix
On 2018-03-29 10:25 PM, Wei Yongjun wrote:
> Passing NULL pointer to PTR_ERR will result in return value of 0
> indicating success which is clearly not what it is intended here.
> This patch returns -EINVAL instead.
>
> Fixes: 5ec7e02854b3 ("drm/amdkfd: Add ioctls for GPUVM memory management")
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> ---
> drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
> index cd679cf..c32a341 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
> @@ -1421,7 +1421,7 @@ static int kfd_ioctl_unmap_memory_from_gpu(struct file *filep,
>
> pdd = kfd_get_process_device_data(dev, p);
> if (!pdd) {
> - err = PTR_ERR(pdd);
> + err = -EINVAL;
> goto bind_process_to_device_failed;
> }
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH -next] drm/amdkfd: Fix the error return code in kfd_ioctl_unmap_memory_from_gpu()
2018-04-02 18:02 ` Felix Kuehling
@ 2018-04-24 9:16 ` Oded Gabbay
0 siblings, 0 replies; 3+ messages in thread
From: Oded Gabbay @ 2018-04-24 9:16 UTC (permalink / raw)
To: Felix Kuehling
Cc: Wei Yongjun, Alex Deucher, Christian König,
David (ChunMing) Zhou, David Airlie,
Maling list - DRI developers, amd-gfx list,
Linux-Kernel@Vger. Kernel. Org, kernel-janitors
On Mon, Apr 2, 2018 at 9:02 PM, Felix Kuehling <felix.kuehling@amd.com> wrote:
> Thanks for catching that. I'd use -ENODEV to match what is done a few
> lines below for peer_pdd. With that fixed, this patch is Reviewed-by:
> Felix Kuehling <Felix.Kuehling@amd.com>
>
> Regards,
> Felix
>
>
> On 2018-03-29 10:25 PM, Wei Yongjun wrote:
>> Passing NULL pointer to PTR_ERR will result in return value of 0
>> indicating success which is clearly not what it is intended here.
>> This patch returns -EINVAL instead.
>>
>> Fixes: 5ec7e02854b3 ("drm/amdkfd: Add ioctls for GPUVM memory management")
>> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
>> ---
>> drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
>> index cd679cf..c32a341 100644
>> --- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
>> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
>> @@ -1421,7 +1421,7 @@ static int kfd_ioctl_unmap_memory_from_gpu(struct file *filep,
>>
>> pdd = kfd_get_process_device_data(dev, p);
>> if (!pdd) {
>> - err = PTR_ERR(pdd);
>> + err = -EINVAL;
>> goto bind_process_to_device_failed;
>> }
>>
>
Thanks!
Applied to -fixes with the -ENODEV return code
Oded
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-04-24 9:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-30 2:25 [PATCH -next] drm/amdkfd: Fix the error return code in kfd_ioctl_unmap_memory_from_gpu() Wei Yongjun
2018-04-02 18:02 ` Felix Kuehling
2018-04-24 9:16 ` Oded Gabbay
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®