From: jsg Date: Fri, 11 Oct 2024 02:42:47 +0000 (+0000) Subject: drm/amd/pm: ensure the fw_info is not null before using it X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=1ad9196c0e04f7a0802688eaeac2df750644928d;p=openbsd drm/amd/pm: ensure the fw_info is not null before using it From Tim Huang b511474f49588cdca355ebfce54e7eddbf7b75a5 in linux-6.6.y/6.6.55 186fb12e7a7b038c2710ceb2fb74068f1b5d55a4 in mainline linux --- diff --git a/sys/dev/pci/drm/amd/pm/powerplay/hwmgr/processpptables.c b/sys/dev/pci/drm/amd/pm/powerplay/hwmgr/processpptables.c index 5794b64507b..56a22575258 100644 --- a/sys/dev/pci/drm/amd/pm/powerplay/hwmgr/processpptables.c +++ b/sys/dev/pci/drm/amd/pm/powerplay/hwmgr/processpptables.c @@ -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)))