All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <christian.koenig@amd.com>
To: Ian Rogers <irogers@google.com>,
	Alex Deucher <alexander.deucher@amd.com>,
	David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>
Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	linux-kernel@vger.kernel.org, llvm@lists.linux.dev,
	Elkin Cruz <elkin@google.com>
Subject: Re: [PATCH 2/2] drm/amdgpu: initialize r in amdgpu_ttm_clear_buffer()
Date: Fri, 20 Nov 2026 13:11:54 +0100	[thread overview]
Message-ID: <dc491d12-68f0-4297-acda-f122fec00288@amd.com> (raw)
In-Reply-To: <6fcb1e5c7545f8bcfee9ac9a3abd296c475aa1b7.1795106955.git.irogers@google.com>



On 11/19/26 18:07, Ian Rogers wrote:
> In amdgpu_ttm_clear_buffer(), 'r' is declared uninitialized. When
> consider_clear_status is true (such as AMDGPU_GEM_CREATE_VRAM_CLEARED
> allocations) and all backing buddy blocks already have DRM_BUDDY_CLEARED
> set, every iteration of the cursor loop hits 'continue' without assigning
> 'r', returning uninitialized stack memory to amdgpu_bo_create().
> 
> Initialize 'r' to 0.
> 
> Found via an x86_64 LLVM=1 (Clang 21.1.8) allyesconfig audit with
> -Wconditional-uninitialized enabled; fix and changelog drafted with an AI
> coding assistant. Build-tested under LLVM=1 W=1 (-Werror) and
> -Wconditional-uninitialized; not runtime-tested on AMD GPU hardware.
> 
> Fixes: 23bd7e67961e ("drm/amdgpu: get rid of amdgpu_ttm_clear_buffer")
> Signed-off-by: Ian Rogers <irogers@google.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> index 0f86777250fc..280fcdfb9cca 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> @@ -2675,7 +2675,7 @@ int amdgpu_ttm_clear_buffer(struct amdgpu_ttm_buffer_entity *entity,
>  	struct dma_fence *fence = NULL;
>  	struct amdgpu_res_cursor dst;
>  	bool vm_needs_flush = false;
> -	int r;
> +	int r = 0;

Please initialize r directly before the error label, apart from that looks good to me.

Regards,
Christian.

>  
>  	if (!entity)
>  		return -EINVAL;


  reply	other threads:[~2026-11-20 12:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19 17:07 [PATCH 0/2] drm/amdgpu: Initialize r in VM and TTM buffer helpers Ian Rogers
2026-11-19 17:07 ` [PATCH 1/2] drm/amdgpu: initialize r in amdgpu_vm_bo_update() Ian Rogers
2026-11-20 12:07   ` Christian König
2026-11-20 17:30     ` Ian Rogers
2026-11-19 17:07 ` [PATCH 2/2] drm/amdgpu: initialize r in amdgpu_ttm_clear_buffer() Ian Rogers
2026-11-20 12:11   ` Christian König [this message]
2026-11-20 17:31     ` Ian Rogers

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=dc491d12-68f0-4297-acda-f122fec00288@amd.com \
    --to=christian.koenig@amd.com \
    --cc=airlied@gmail.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=elkin@google.com \
    --cc=irogers@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=simona@ffwll.ch \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.