Re: [PATCH] drm/amdgpu: partially revert powerplay `__counted_by` changes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/4/2024 09:17, Alex Deucher wrote:
Ping?

On Thu, Oct 3, 2024 at 10:06 AM Alex Deucher <alexander.deucher@xxxxxxx> wrote:

Partially revert
commit 0ca9f757a0e2 ("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.

Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/3662
Signed-off-by: Alex Deucher <alexander.deucher@xxxxxxx>
Reviewed-by: Mario Limonciello <mario.limonciello@xxxxxxx>
---
  drivers/gpu/drm/amd/pm/powerplay/inc/hwmgr.h | 26 ++++++++++----------
  1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/amd/pm/powerplay/inc/hwmgr.h b/drivers/gpu/drm/amd/pm/powerplay/inc/hwmgr.h
index 9118fcddbf11..227bf0e84a13 100644
--- a/drivers/gpu/drm/amd/pm/powerplay/inc/hwmgr.h
+++ b/drivers/gpu/drm/amd/pm/powerplay/inc/hwmgr.h
@@ -60,7 +60,7 @@ struct vi_dpm_level {

  struct vi_dpm_table {
         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
@@ -91,7 +91,7 @@ struct phm_set_power_state_input {

  struct phm_clock_array {
         uint32_t count;
-       uint32_t values[] __counted_by(count);
+       uint32_t values[];
  };

  struct phm_clock_voltage_dependency_record {
@@ -123,7 +123,7 @@ struct phm_acpclock_voltage_dependency_record {

  struct phm_clock_voltage_dependency_table {
         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 {
@@ -140,7 +140,7 @@ struct phm_uvd_clock_voltage_dependency_record {

  struct phm_uvd_clock_voltage_dependency_table {
         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 {
@@ -150,7 +150,7 @@ struct phm_acp_clock_voltage_dependency_record {

  struct phm_acp_clock_voltage_dependency_table {
         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 {
@@ -161,32 +161,32 @@ struct phm_vce_clock_voltage_dependency_record {

  struct phm_phase_shedding_limits_table {
         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 {
         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 {
         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 {
         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 {
         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 {
         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 {

  struct phm_cac_leakage_table {
         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 {
@@ -404,7 +404,7 @@ struct phm_samu_clock_voltage_dependency_record {

  struct phm_samu_clock_voltage_dependency_table {
         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 {
--
2.46.2





[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux