Skip to contentSkip to conversation

drm/amdgpu: Uninitialized variable in gfx_v9_0_rlcg_wreg()

PATCH New Dan Carpenter 1 participant 1 message Mar 20, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu: Uninitialized variable in gfx_v9_0_rlcg_wreg()

The "shadow" variable was never set to false.

There is a quirk in current versions of GCC where it will sometimes set it to false and not warn about the uninitiliazed variable. That means that this bug wouldn't have been discovered in normal testing.

Fixes 2e0cc4d48b91 ("drm/amdgpu: revise RLCG access path")
---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1 -1
index 7bc2486167e7..affbff76758c 100644
@@ -735,7 +735,7 @@ void gfx_v9_0_rlcg_wreg(struct amdgpu_device *adev, u32 offset, u32 v)
 	static void *spare_int;
 	static uint32_t grbm_cntl;
 	static uint32_t grbm_idx;
-	bool shadow;
+	bool shadow = false;
 
 	scratch_reg0 = adev->rmmio + (adev->reg_offset[GC_HWIP][0][mmSCRATCH_REG0_BASE_IDX] + mmSCRATCH_REG0)*4;
 	scratch_reg1 = adev->rmmio + (adev->reg_offset[GC_HWIP][0][mmSCRATCH_REG1_BASE_IDX] + mmSCRATCH_REG1)*4;
Signature · 1 line
2.25.1