From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Deucher, Alexander" Subject: Re: [PATCH 1/1] drm/amdkfd: Fix handling of return code of dma_buf_get Date: Fri, 14 Dec 2018 19:21:22 +0000 Message-ID: References: <1544814297-13439-1-git-send-email-Felix.Kuehling@amd.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0448531300==" Return-path: In-Reply-To: <1544814297-13439-1-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org> Content-Language: en-US List-Id: Discussion list for AMD gfx List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org Sender: "amd-gfx" To: "Kuehling, Felix" , "amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org" --===============0448531300== Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_BN6PR12MB18099BB9477C1457B4BB5D23F7A10BN6PR12MB1809namp_" --_000_BN6PR12MB18099BB9477C1457B4BB5D23F7A10BN6PR12MB1809namp_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Alex Deucher ________________________________ From: amd-gfx on behalf of Kuehling= , Felix Sent: Friday, December 14, 2018 2:05:11 PM To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org Cc: Kuehling, Felix Subject: [PATCH 1/1] drm/amdkfd: Fix handling of return code of dma_buf_get On errors, dma_buf_get returns a negative error code, rather than NULL. Reported-by: Dan Carpenter Signed-off-by: Felix Kuehling --- drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c b/drivers/gpu/drm/amd= /amdkfd/kfd_chardev.c index 3623538..db6f27f 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c @@ -1629,8 +1629,8 @@ static int kfd_ioctl_import_dmabuf(struct file *filep= , return -EINVAL; dmabuf =3D dma_buf_get(args->dmabuf_fd); - if (!dmabuf) - return -EINVAL; + if (IS_ERR(dmabuf)) + return PTR_ERR(dmabuf); mutex_lock(&p->mutex); -- 2.7.4 _______________________________________________ amd-gfx mailing list amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx --_000_BN6PR12MB18099BB9477C1457B4BB5D23F7A10BN6PR12MB1809namp_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Reviewed-by: Alex Deucher <ale= xander.deucher-5C7GfCeVMHo@public.gmane.org>


From: amd-gfx <amd-gfx-b= ounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> on behalf of Kuehling, Felix <Felix.Kue= hling-5C7GfCeVMHo@public.gmane.org>
Sent: Friday, December 14, 2018 2:05:11 PM
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Cc: Kuehling, Felix
Subject: [PATCH 1/1] drm/amdkfd: Fix handling of return code of dma_= buf_get
 
On errors, dma_buf_get returns a negative error co= de, rather than NULL.

Reported-by: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
Signed-off-by: Felix Kuehling <Felix.Kuehling-5C7GfCeVMHo@public.gmane.org>
---
 drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c b/drivers/gpu/drm/amd= /amdkfd/kfd_chardev.c
index 3623538..db6f27f 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
@@ -1629,8 +1629,8 @@ static int kfd_ioctl_import_dmabuf(struct file *f= ilep,
            &nb= sp;    return -EINVAL;
 
         dmabuf =3D dma_buf_get(arg= s->dmabuf_fd);
-       if (!dmabuf)
-            &n= bsp;  return -EINVAL;
+       if (IS_ERR(dmabuf))
+           &nbs= p;   return PTR_ERR(dmabuf);
 
         mutex_lock(&p->mute= x);
 
--
2.7.4

_______________________________________________
amd-gfx mailing list
amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
https://= lists.freedesktop.org/mailman/listinfo/amd-gfx
--_000_BN6PR12MB18099BB9477C1457B4BB5D23F7A10BN6PR12MB1809namp_-- --===============0448531300== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KYW1kLWdmeCBt YWlsaW5nIGxpc3QKYW1kLWdmeEBsaXN0cy5mcmVlZGVza3RvcC5vcmcKaHR0cHM6Ly9saXN0cy5m cmVlZGVza3RvcC5vcmcvbWFpbG1hbi9saXN0aW5mby9hbWQtZ2Z4Cg== --===============0448531300==--