All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: avoid uninitialized pointer use
@ 2026-12-01  9:15 Arnd Bergmann
  2026-12-01 14:39 ` Alex Deucher
  0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2026-12-01  9:15 UTC (permalink / raw)
  To: Alex Deucher, Christian König, David Airlie, Simona Vetter,
	Nathan Chancellor, Hawking Zhang, Likun Gao, Frank Min
  Cc: Arnd Bergmann, Nick Desaulniers, Bill Wendling, Justin Stitt,
	amd-gfx, dri-devel, llvm

From: Arnd Bergmann <arnd@arndb.de>

clang warns about passing an uninitialized pointer into another
function, even when that function does not access the pointer:

drivers/gpu/drm/amd/amdgpu/imu_v13_0.c:264:30: error: variable 'data' is uninitialized when used here [-Werror,-Wuninitialized]
  264 |                         program_imu_rlc_ram(adev, data, (const u32)size);
      |                                                   ^~~~

Presumably there are plans to add an actual register array later that would
make this similar to other versions of the imu code.  In the meantime,
remove the unused/uninitialized pointer and just pass a hardcoded NULL/0
argument to program_imu_rlc_ram.

Fixes: 9caddf5f7de7 ("drm/amdgpu: Add imu v13 ip block v2")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/gpu/drm/amd/amdgpu/imu_v13_0.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/imu_v13_0.c b/drivers/gpu/drm/amd/amdgpu/imu_v13_0.c
index aea418be444a..660bd587c7d7 100644
--- a/drivers/gpu/drm/amd/amdgpu/imu_v13_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/imu_v13_0.c
@@ -252,8 +252,7 @@ static void program_imu_rlc_ram(struct amdgpu_device *adev,
 
 static void imu_v13_0_program_rlc_ram(struct amdgpu_device *adev)
 {
-	u32 reg_data, size = 0;
-	const u32 *data;
+	u32 reg_data;
 	int r = -EINVAL;
 
 	WREG32_SOC15(GC, 0, regGFX_IMU_RLC_RAM_INDEX, 0x2);
@@ -261,7 +260,7 @@ static void imu_v13_0_program_rlc_ram(struct amdgpu_device *adev)
 	switch (amdgpu_ip_version(adev, GC_HWIP, 0)) {
 	case IP_VERSION(13, 0, 1):
 		if (!r)
-			program_imu_rlc_ram(adev, data, (const u32)size);
+			program_imu_rlc_ram(adev, NULL, 0);
 		break;
 	default:
 		BUG();
-- 
2.53.0


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

* Re: [PATCH] drm/amdgpu: avoid uninitialized pointer use
  2026-12-01  9:15 [PATCH] drm/amdgpu: avoid uninitialized pointer use Arnd Bergmann
@ 2026-12-01 14:39 ` Alex Deucher
  0 siblings, 0 replies; 2+ messages in thread
From: Alex Deucher @ 2026-12-01 14:39 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Alex Deucher, Christian König, David Airlie, Simona Vetter,
	Nathan Chancellor, Hawking Zhang, Likun Gao, Frank Min,
	Arnd Bergmann, Nick Desaulniers, Bill Wendling, Justin Stitt,
	amd-gfx, dri-devel, llvm

On Tue, Dec 1, 2026 at 4:26 AM Arnd Bergmann <arnd@kernel.org> wrote:
>
> From: Arnd Bergmann <arnd@arndb.de>
>
> clang warns about passing an uninitialized pointer into another
> function, even when that function does not access the pointer:
>
> drivers/gpu/drm/amd/amdgpu/imu_v13_0.c:264:30: error: variable 'data' is uninitialized when used here [-Werror,-Wuninitialized]
>   264 |                         program_imu_rlc_ram(adev, data, (const u32)size);
>       |                                                   ^~~~
>
> Presumably there are plans to add an actual register array later that would
> make this similar to other versions of the imu code.  In the meantime,
> remove the unused/uninitialized pointer and just pass a hardcoded NULL/0
> argument to program_imu_rlc_ram.
>
> Fixes: 9caddf5f7de7 ("drm/amdgpu: Add imu v13 ip block v2")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Already fixed and squashed into the original patch.

Thanks,

Alex

> ---
>  drivers/gpu/drm/amd/amdgpu/imu_v13_0.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/imu_v13_0.c b/drivers/gpu/drm/amd/amdgpu/imu_v13_0.c
> index aea418be444a..660bd587c7d7 100644
> --- a/drivers/gpu/drm/amd/amdgpu/imu_v13_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/imu_v13_0.c
> @@ -252,8 +252,7 @@ static void program_imu_rlc_ram(struct amdgpu_device *adev,
>
>  static void imu_v13_0_program_rlc_ram(struct amdgpu_device *adev)
>  {
> -       u32 reg_data, size = 0;
> -       const u32 *data;
> +       u32 reg_data;
>         int r = -EINVAL;
>
>         WREG32_SOC15(GC, 0, regGFX_IMU_RLC_RAM_INDEX, 0x2);
> @@ -261,7 +260,7 @@ static void imu_v13_0_program_rlc_ram(struct amdgpu_device *adev)
>         switch (amdgpu_ip_version(adev, GC_HWIP, 0)) {
>         case IP_VERSION(13, 0, 1):
>                 if (!r)
> -                       program_imu_rlc_ram(adev, data, (const u32)size);
> +                       program_imu_rlc_ram(adev, NULL, 0);
>                 break;
>         default:
>                 BUG();
> --
> 2.53.0
>

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

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

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-01  9:15 [PATCH] drm/amdgpu: avoid uninitialized pointer use Arnd Bergmann
2026-12-01 14:39 ` Alex Deucher

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.