linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] drm/amdkfd: Fix NULL but dereferenced coccicheck error
@ 2022-02-09  1:39 Yang Li
  2022-02-09 21:14 ` Felix Kuehling
  0 siblings, 1 reply; 2+ messages in thread
From: Yang Li @ 2022-02-09  1:39 UTC (permalink / raw)
  To: daniel
  Cc: airlied, Felix.Kuehling, alexander.deucher, christian.koenig,
	Xinhui.Pan, amd-gfx, dri-devel, linux-kernel, Yang Li,
	Abaci Robot

Eliminate the following coccicheck warning:
./drivers/gpu/drm/amd/amdkfd/kfd_chardev.c:2087:27-38: ERROR: bo_buckets
is NULL but dereferenced.

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
---
 drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
index 64e3b4e3a712..636391c61caf 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
@@ -1982,10 +1982,8 @@ static int criu_checkpoint_bos(struct kfd_process *p,
 	void *mem;
 
 	bo_buckets = kvzalloc(num_bos * sizeof(*bo_buckets), GFP_KERNEL);
-	if (!bo_buckets) {
-		ret = -ENOMEM;
-		goto exit;
-	}
+	if (!bo_buckets)
+		return -ENOMEM;
 
 	bo_privs = kvzalloc(num_bos * sizeof(*bo_privs), GFP_KERNEL);
 	if (!bo_privs) {
-- 
2.20.1.7.g153144c


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH -next] drm/amdkfd: Fix NULL but dereferenced coccicheck error
  2022-02-09  1:39 [PATCH -next] drm/amdkfd: Fix NULL but dereferenced coccicheck error Yang Li
@ 2022-02-09 21:14 ` Felix Kuehling
  0 siblings, 0 replies; 2+ messages in thread
From: Felix Kuehling @ 2022-02-09 21:14 UTC (permalink / raw)
  To: Yang Li, daniel
  Cc: airlied, alexander.deucher, christian.koenig, Xinhui.Pan,
	amd-gfx, dri-devel, linux-kernel, Abaci Robot


On 2022-02-08 20:39, Yang Li wrote:
> Eliminate the following coccicheck warning:
> ./drivers/gpu/drm/amd/amdkfd/kfd_chardev.c:2087:27-38: ERROR: bo_buckets
> is NULL but dereferenced.
>
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>

Thank you. I already picket up Tom Rix's patch for the same issue.

Regards,
   Felix


> ---
>   drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 6 ++----
>   1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
> index 64e3b4e3a712..636391c61caf 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
> @@ -1982,10 +1982,8 @@ static int criu_checkpoint_bos(struct kfd_process *p,
>   	void *mem;
>   
>   	bo_buckets = kvzalloc(num_bos * sizeof(*bo_buckets), GFP_KERNEL);
> -	if (!bo_buckets) {
> -		ret = -ENOMEM;
> -		goto exit;
> -	}
> +	if (!bo_buckets)
> +		return -ENOMEM;
>   
>   	bo_privs = kvzalloc(num_bos * sizeof(*bo_privs), GFP_KERNEL);
>   	if (!bo_privs) {

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-02-09 21:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-09  1:39 [PATCH -next] drm/amdkfd: Fix NULL but dereferenced coccicheck error Yang Li
2022-02-09 21:14 ` Felix Kuehling

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).