AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: fix uninitialized variable in amdgpu_fill_buffer()
@ 2026-02-05  2:16 Samasth Norway Ananda
  2026-02-05  9:49 ` Christian König
  0 siblings, 1 reply; 2+ messages in thread
From: Samasth Norway Ananda @ 2026-02-05  2:16 UTC (permalink / raw)
  To: alexander.deucher, christian.koenig, amd-gfx,
	pierre-eric.pelloux-prayer
  Cc: samasth.norway.ananda

Initialize 'r' to 0 so the function does not return an uninitialized
value when the while loop body is never entered. Current callers always
supply non-zero sized BOs so the loop always executes, but the function
itself does not enforce this and static analysis tools flag the
potential use.

Fixes: 22f7cc752408 ("drm/amdgpu: restructure amdgpu_fill_buffer v2")
Signed-off-by: Samasth Norway Ananda <samasth.norway.ananda@oracle.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 15d561e3d87f..44524eb2f74f 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -2564,7 +2564,7 @@ int amdgpu_fill_buffer(struct amdgpu_ttm_buffer_entity *entity,
 	struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev);
 	struct dma_fence *fence = NULL;
 	struct amdgpu_res_cursor dst;
-	int r;
+	int r = 0;
 
 	if (!adev->mman.buffer_funcs_enabled) {
 		dev_err(adev->dev,
-- 
2.50.1


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

end of thread, other threads:[~2026-02-05 14:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-05  2:16 [PATCH] drm/amdgpu: fix uninitialized variable in amdgpu_fill_buffer() Samasth Norway Ananda
2026-02-05  9:49 ` Christian König

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox