public inbox for llvm@lists.linux.dev
 help / color / mirror / Atom feed
From: Felix Kuehling <felix.kuehling@amd.com>
To: trix@redhat.com, alexander.deucher@amd.com,
	christian.koenig@amd.com, Xinhui.Pan@amd.com, airlied@linux.ie,
	daniel@ffwll.ch, nathan@kernel.org, ndesaulniers@google.com,
	david.yatsin@amd.com, rajneesh.bhardwaj@amd.com
Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	linux-kernel@vger.kernel.org, llvm@lists.linux.dev
Subject: Re: [PATCH] drm/amdkfd: fix freeing an unset pointer
Date: Wed, 9 Feb 2022 15:34:51 -0500	[thread overview]
Message-ID: <c8ae4761-ce66-1a37-e323-0aefe23f555c@amd.com> (raw)
In-Reply-To: <20220209145254.2291158-1-trix@redhat.com>


On 2022-02-09 09:52, trix@redhat.com wrote:
> From: Tom Rix <trix@redhat.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@redhat.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) {

      reply	other threads:[~2022-02-09 20:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-09 14:52 [PATCH] drm/amdkfd: fix freeing an unset pointer trix
2022-02-09 20:34 ` Felix Kuehling [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c8ae4761-ce66-1a37-e323-0aefe23f555c@amd.com \
    --to=felix.kuehling@amd.com \
    --cc=Xinhui.Pan@amd.com \
    --cc=airlied@linux.ie \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=christian.koenig@amd.com \
    --cc=daniel@ffwll.ch \
    --cc=david.yatsin@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=rajneesh.bhardwaj@amd.com \
    --cc=trix@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox