Re: [PATCH 3/3] drm/amdgpu: Fix Uninitialized scalar variable warning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am 23.04.24 um 04:53 schrieb Ma, Jun:
  	unsigned int client_id, src_id;
  	struct amdgpu_irq_src *src;
  	bool handled = false;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
index 924baf58e322..f0a63d084b4d 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
@@ -1559,7 +1559,7 @@ static int amdgpu_debugfs_firmware_info_show(struct seq_file *m, void *unused)
  {
  	struct amdgpu_device *adev = m->private;
  	struct drm_amdgpu_info_firmware fw_info;
-	struct drm_amdgpu_query_fw query_fw;
+	struct drm_amdgpu_query_fw query_fw = {0};
Coverity warning:
uninit_use_in_call Using uninitialized value query_fw.index when calling amdgpu_firmware_info

Even though qeuery_fw.index was assigned a value before it's used, there is still an coverity warning.
We need to initialize query_fw when declare it.

But initializing it to zero doesn't sounds correct either.

The amdgpu_firmware_info() function is designed to return the FW info for a specific block, if the block isn't specified than coverity is right that we have a coding error here.

Just initializing the value silences coverity but is most likely not the right thing to do.

Regards,
Christian.


  	struct atom_context *ctx = adev->mode_info.atom_context;
  	uint8_t smu_program, smu_major, smu_minor, smu_debug;
  	int ret, i;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_xcp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_xcp.c
index 2b99eed5ba19..41ac3319108b 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_xcp.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_xcp.c
@@ -120,7 +120,7 @@ static void __amdgpu_xcp_add_block(struct amdgpu_xcp_mgr *xcp_mgr, int xcp_id,
  int amdgpu_xcp_init(struct amdgpu_xcp_mgr *xcp_mgr, int num_xcps, int mode)
  {
  	struct amdgpu_device *adev = xcp_mgr->adev;
-	struct amdgpu_xcp_ip ip;
+	struct amdgpu_xcp_ip ip = {0};
Coverity Warning:
Using uninitialized value ip. Field ip.valid is uninitialized when calling __amdgpu_xcp_add_block

The code is ok. We just need to initialize the variable ip.

Regards,
Ma Jun


  	uint8_t mem_id;
  	int i, j, ret;
  

      


[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux