lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <c8ae4761-ce66-1a37-e323-0aefe23f555c@amd.com>
Date:   Wed, 9 Feb 2022 15:34:51 -0500
From:   Felix Kuehling <felix.kuehling@....com>
To:     trix@...hat.com, alexander.deucher@....com,
        christian.koenig@....com, Xinhui.Pan@....com, airlied@...ux.ie,
        daniel@...ll.ch, nathan@...nel.org, ndesaulniers@...gle.com,
        david.yatsin@....com, rajneesh.bhardwaj@....com
Cc:     amd-gfx@...ts.freedesktop.org, dri-devel@...ts.freedesktop.org,
        linux-kernel@...r.kernel.org, llvm@...ts.linux.dev
Subject: Re: [PATCH] drm/amdkfd: fix freeing an unset pointer


On 2022-02-09 09:52, trix@...hat.com wrote:
> From: Tom Rix <trix@...hat.com>
>
> clang static analysis reports this problem
> kfd_chardev.c:2092:2: warning: 1st function call argument
>    is an uninitialized value
>          kvfree(bo_privs);
>          ^~~~~~~~~~~~~~~~
>
> When bo_buckets alloc fails, it jumps to an error handler
> that frees the yet to be allocated bo_privs.  Because
> bo_buckets is the first error, return directly.
>
> Fixes: 5ccbb057c0a1 ("drm/amdkfd: CRIU Implement KFD checkpoint ioctl")

Thank you, Tom. I'm applying your patch to amd-staging-drm-next.

Regards,
   Felix


>
> Signed-off-by: Tom Rix <trix@...hat.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 64e3b4e3a7126..636391c61cafb 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) {

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ