There is a regular need in the kernel to provide a way to declare having a dynamically sized set of trailing elements in a structure. Kernel code should always use “flexible array members”[1] for these cases. The older style of one-element or zero-length arrays should no longer be used[2]. Refactor the code according to the use of a flexible-array member in struct phm_uvd_clock_voltage_dependency_table, instead of a one-element array, and use the struct_size() helper to calculate the size for the allocation. Also, save some heap space as the original code is multiplying table->numEntries by sizeof(struct phm_uvd_clock_voltage_dependency_table) when it should have multiplied it by sizeof(phm_uvd_clock_voltage_dependency_record) instead. [1] https://en.wikipedia.org/wiki/Flexible_array_member [2] https://www.kernel.org/doc/html/v5.9-rc1/process/deprecated.html#zero-length-and-one-element-arrays Build-tested-by: kernel test robot <lkp@intel.com> Link: https://lore.kernel.org/lkml/5f7c433e.pXkC6KsN6HN%2FLdhj%25lkp@intel.com/ Acked-by: Christian König <christian.koenig@amd.com> Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> |
||
---|---|---|
.. | ||
vega12 | ||
amd_powerplay.h | ||
amdgpu_dpm.h | ||
amdgpu_pm.h | ||
amdgpu_smu.h | ||
arcturus_ppsmc.h | ||
cz_ppsmc.h | ||
fiji_ppsmc.h | ||
hardwaremanager.h | ||
hwmgr.h | ||
polaris10_pwrvirus.h | ||
power_state.h | ||
pp_debug.h | ||
pp_endian.h | ||
pp_thermal.h | ||
ppinterrupt.h | ||
rv_ppsmc.h | ||
smu7_common.h | ||
smu7_discrete.h | ||
smu7_fusion.h | ||
smu7_ppsmc.h | ||
smu7.h | ||
smu8_fusion.h | ||
smu8.h | ||
smu9_driver_if.h | ||
smu9.h | ||
smu10_driver_if.h | ||
smu10.h | ||
smu11_driver_if_arcturus.h | ||
smu11_driver_if_navi10.h | ||
smu11_driver_if_sienna_cichlid.h | ||
smu11_driver_if_vangogh.h | ||
smu11_driver_if.h | ||
smu12_driver_if.h | ||
smu71_discrete.h | ||
smu71.h | ||
smu72_discrete.h | ||
smu72.h | ||
smu73_discrete.h | ||
smu73.h | ||
smu74_discrete.h | ||
smu74.h | ||
smu75_discrete.h | ||
smu75.h | ||
smu_11_0_cdr_table.h | ||
smu_types.h | ||
smu_ucode_xfer_cz.h | ||
smu_ucode_xfer_vi.h | ||
smu_v11_0_7_ppsmc.h | ||
smu_v11_0_7_pptable.h | ||
smu_v11_0_ppsmc.h | ||
smu_v11_0_pptable.h | ||
smu_v11_0.h | ||
smu_v11_5_pmfw.h | ||
smu_v11_5_ppsmc.h | ||
smu_v12_0_ppsmc.h | ||
smu_v12_0.h | ||
smumgr.h | ||
tonga_ppsmc.h | ||
vega10_ppsmc.h | ||
vega12_ppsmc.h | ||
vega20_ppsmc.h |