Commit d6b9f492 authored by Alex Deucher's avatar Alex Deucher

drm/amdgpu: partially revert powerplay `__counted_by` changes

Partially revert
commit 0ca9f757 ("drm/amd/pm: powerplay: Add `__counted_by` attribute for flexible arrays")

The count attribute for these arrays does not get set until
after the arrays are allocated and populated leading to false
UBSAN warnings.

Fixes: 0ca9f757 ("drm/amd/pm: powerplay: Add `__counted_by` attribute for flexible arrays")
Reviewed-by: default avatarMario Limonciello <mario.limonciello@amd.com>
Reviewed-by: default avatarLijo Lazar <lijo.lazar@amd.com>
Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/3662Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
(cherry picked from commit 8a5ae927b653b43623e55610d2215ee94c027e8c)
Cc: stable@vger.kernel.org
parent 8e82d119
...@@ -60,7 +60,7 @@ struct vi_dpm_level { ...@@ -60,7 +60,7 @@ struct vi_dpm_level {
struct vi_dpm_table { struct vi_dpm_table {
uint32_t count; uint32_t count;
struct vi_dpm_level dpm_level[] __counted_by(count); struct vi_dpm_level dpm_level[];
}; };
#define PCIE_PERF_REQ_REMOVE_REGISTRY 0 #define PCIE_PERF_REQ_REMOVE_REGISTRY 0
...@@ -91,7 +91,7 @@ struct phm_set_power_state_input { ...@@ -91,7 +91,7 @@ struct phm_set_power_state_input {
struct phm_clock_array { struct phm_clock_array {
uint32_t count; uint32_t count;
uint32_t values[] __counted_by(count); uint32_t values[];
}; };
struct phm_clock_voltage_dependency_record { struct phm_clock_voltage_dependency_record {
...@@ -123,7 +123,7 @@ struct phm_acpclock_voltage_dependency_record { ...@@ -123,7 +123,7 @@ struct phm_acpclock_voltage_dependency_record {
struct phm_clock_voltage_dependency_table { struct phm_clock_voltage_dependency_table {
uint32_t count; uint32_t count;
struct phm_clock_voltage_dependency_record entries[] __counted_by(count); struct phm_clock_voltage_dependency_record entries[];
}; };
struct phm_phase_shedding_limits_record { struct phm_phase_shedding_limits_record {
...@@ -140,7 +140,7 @@ struct phm_uvd_clock_voltage_dependency_record { ...@@ -140,7 +140,7 @@ struct phm_uvd_clock_voltage_dependency_record {
struct phm_uvd_clock_voltage_dependency_table { struct phm_uvd_clock_voltage_dependency_table {
uint8_t count; uint8_t count;
struct phm_uvd_clock_voltage_dependency_record entries[] __counted_by(count); struct phm_uvd_clock_voltage_dependency_record entries[];
}; };
struct phm_acp_clock_voltage_dependency_record { struct phm_acp_clock_voltage_dependency_record {
...@@ -150,7 +150,7 @@ struct phm_acp_clock_voltage_dependency_record { ...@@ -150,7 +150,7 @@ struct phm_acp_clock_voltage_dependency_record {
struct phm_acp_clock_voltage_dependency_table { struct phm_acp_clock_voltage_dependency_table {
uint32_t count; uint32_t count;
struct phm_acp_clock_voltage_dependency_record entries[] __counted_by(count); struct phm_acp_clock_voltage_dependency_record entries[];
}; };
struct phm_vce_clock_voltage_dependency_record { struct phm_vce_clock_voltage_dependency_record {
...@@ -161,32 +161,32 @@ struct phm_vce_clock_voltage_dependency_record { ...@@ -161,32 +161,32 @@ struct phm_vce_clock_voltage_dependency_record {
struct phm_phase_shedding_limits_table { struct phm_phase_shedding_limits_table {
uint32_t count; uint32_t count;
struct phm_phase_shedding_limits_record entries[] __counted_by(count); struct phm_phase_shedding_limits_record entries[];
}; };
struct phm_vceclock_voltage_dependency_table { struct phm_vceclock_voltage_dependency_table {
uint8_t count; uint8_t count;
struct phm_vceclock_voltage_dependency_record entries[] __counted_by(count); struct phm_vceclock_voltage_dependency_record entries[];
}; };
struct phm_uvdclock_voltage_dependency_table { struct phm_uvdclock_voltage_dependency_table {
uint8_t count; uint8_t count;
struct phm_uvdclock_voltage_dependency_record entries[] __counted_by(count); struct phm_uvdclock_voltage_dependency_record entries[];
}; };
struct phm_samuclock_voltage_dependency_table { struct phm_samuclock_voltage_dependency_table {
uint8_t count; uint8_t count;
struct phm_samuclock_voltage_dependency_record entries[] __counted_by(count); struct phm_samuclock_voltage_dependency_record entries[];
}; };
struct phm_acpclock_voltage_dependency_table { struct phm_acpclock_voltage_dependency_table {
uint32_t count; uint32_t count;
struct phm_acpclock_voltage_dependency_record entries[] __counted_by(count); struct phm_acpclock_voltage_dependency_record entries[];
}; };
struct phm_vce_clock_voltage_dependency_table { struct phm_vce_clock_voltage_dependency_table {
uint8_t count; uint8_t count;
struct phm_vce_clock_voltage_dependency_record entries[] __counted_by(count); struct phm_vce_clock_voltage_dependency_record entries[];
}; };
...@@ -393,7 +393,7 @@ union phm_cac_leakage_record { ...@@ -393,7 +393,7 @@ union phm_cac_leakage_record {
struct phm_cac_leakage_table { struct phm_cac_leakage_table {
uint32_t count; uint32_t count;
union phm_cac_leakage_record entries[] __counted_by(count); union phm_cac_leakage_record entries[];
}; };
struct phm_samu_clock_voltage_dependency_record { struct phm_samu_clock_voltage_dependency_record {
...@@ -404,7 +404,7 @@ struct phm_samu_clock_voltage_dependency_record { ...@@ -404,7 +404,7 @@ struct phm_samu_clock_voltage_dependency_record {
struct phm_samu_clock_voltage_dependency_table { struct phm_samu_clock_voltage_dependency_table {
uint8_t count; uint8_t count;
struct phm_samu_clock_voltage_dependency_record entries[] __counted_by(count); struct phm_samu_clock_voltage_dependency_record entries[];
}; };
struct phm_cac_tdp_table { struct phm_cac_tdp_table {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment