diff options
author | Srinivasan Shanmugam <srinivasan.shanmugam@amd.com> | 2024-01-03 22:05:16 +0530 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2024-01-05 16:10:43 -0500 |
commit | 4f32504a2f85a7b40fe149436881381f48e9c0c0 (patch) | |
tree | b717c2c4bde2a1fb264d1993483b3dec81025e01 /drivers/irqchip/irq-realtek-rtl.c | |
parent | c572abffe9f50c8ba33060865449313b3f588c35 (diff) | |
download | linux-stable-4f32504a2f85a7b40fe149436881381f48e9c0c0.tar.gz linux-stable-4f32504a2f85a7b40fe149436881381f48e9c0c0.tar.bz2 linux-stable-4f32504a2f85a7b40fe149436881381f48e9c0c0.zip |
drm/amdgpu: Fix variable 'mca_funcs' dereferenced before NULL check in 'amdgpu_mca_smu_get_mca_entry()'
Fixes the below:
drivers/gpu/drm/amd/amdgpu/amdgpu_mca.c:377 amdgpu_mca_smu_get_mca_entry() warn: variable dereferenced before check 'mca_funcs' (see line 368)
357 int amdgpu_mca_smu_get_mca_entry(struct amdgpu_device *adev,
enum amdgpu_mca_error_type type,
358 int idx, struct mca_bank_entry *entry)
359 {
360 const struct amdgpu_mca_smu_funcs *mca_funcs =
adev->mca.mca_funcs;
361 int count;
362
363 switch (type) {
364 case AMDGPU_MCA_ERROR_TYPE_UE:
365 count = mca_funcs->max_ue_count;
mca_funcs is dereferenced here.
366 break;
367 case AMDGPU_MCA_ERROR_TYPE_CE:
368 count = mca_funcs->max_ce_count;
mca_funcs is dereferenced here.
369 break;
370 default:
371 return -EINVAL;
372 }
373
374 if (idx >= count)
375 return -EINVAL;
376
377 if (mca_funcs && mca_funcs->mca_get_mca_entry)
^^^^^^^^^
Checked too late!
Cc: Yang Wang <kevinyang.wang@amd.com>
Cc: Hawking Zhang <Hawking.Zhang@amd.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Reviewed-by: Yang Wang <kevinyang.wang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/irqchip/irq-realtek-rtl.c')
0 files changed, 0 insertions, 0 deletions