Skip to content

Commit 98ae6d6

Browse files
committed
drm/amd/pp: Fix potential NULL pointer dereference in atomctrl_initialize_mc_reg_table
From Charles Han 64f3acc8c7e6809631457b75638601b36dea3129 in linux-6.12.y/6.12.34 820116a39f96bdc7d426c33a804b52f53700a919 in mainline linux
1 parent 25ed657 commit 98ae6d6

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

sys/dev/pci/drm/amd/pm/powerplay/hwmgr/ppatomctrl.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,10 @@ int atomctrl_initialize_mc_reg_table(
144144
vram_info = (ATOM_VRAM_INFO_HEADER_V2_1 *)
145145
smu_atom_get_data_table(hwmgr->adev,
146146
GetIndexIntoMasterTable(DATA, VRAM_Info), &size, &frev, &crev);
147+
if (!vram_info) {
148+
pr_err("Could not retrieve the VramInfo table!");
149+
return -EINVAL;
150+
}
147151

148152
if (module_index >= vram_info->ucNumOfVRAMModule) {
149153
pr_err("Invalid VramInfo table.");
@@ -181,6 +185,10 @@ int atomctrl_initialize_mc_reg_table_v2_2(
181185
vram_info = (ATOM_VRAM_INFO_HEADER_V2_2 *)
182186
smu_atom_get_data_table(hwmgr->adev,
183187
GetIndexIntoMasterTable(DATA, VRAM_Info), &size, &frev, &crev);
188+
if (!vram_info) {
189+
pr_err("Could not retrieve the VramInfo table!");
190+
return -EINVAL;
191+
}
184192

185193
if (module_index >= vram_info->ucNumOfVRAMModule) {
186194
pr_err("Invalid VramInfo table.");

0 commit comments

Comments
 (0)