drm/amd/pm: ensure the fw_info is not null before using it
authorjsg <jsg@openbsd.org>
Fri, 11 Oct 2024 02:42:47 +0000 (02:42 +0000)
committerjsg <jsg@openbsd.org>
Fri, 11 Oct 2024 02:42:47 +0000 (02:42 +0000)
From Tim Huang
b511474f49588cdca355ebfce54e7eddbf7b75a5 in linux-6.6.y/6.6.55
186fb12e7a7b038c2710ceb2fb74068f1b5d55a4 in mainline linux

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

index 5794b64..56a2257 100644 (file)
@@ -1185,6 +1185,8 @@ static int init_overdrive_limits(struct pp_hwmgr *hwmgr,
        fw_info = smu_atom_get_data_table(hwmgr->adev,
                         GetIndexIntoMasterTable(DATA, FirmwareInfo),
                         &size, &frev, &crev);
+       PP_ASSERT_WITH_CODE(fw_info != NULL,
+                           "Missing firmware info!", return -EINVAL);
 
        if ((fw_info->ucTableFormatRevision == 1)
            && (le16_to_cpu(fw_info->usStructureSize) >= sizeof(ATOM_FIRMWARE_INFO_V1_4)))