[PATCH] drm/amd/powerplay: Fix kzalloc parameter 'ATOM_Tonga_PPM_Table' in 'get_platform_power_management_table()'
Alex Deucher
alexdeucher at gmail.com
Fri Jan 5 14:10:53 UTC 2024
On Fri, Jan 5, 2024 at 6:21 AM Srinivasan Shanmugam
<srinivasan.shanmugam at amd.com> wrote:
>
> In struct phm_ppm_table *ptr allocation using kzalloc, an incorrect
> structure type is passed to sizeof() in kzalloc, larger structure types
> were used, thus using correct type 'struct phm_ppm_table' fixes the
> below:
>
> drivers/gpu/drm/amd/amdgpu/../pm/powerplay/hwmgr/process_pptables_v1_0.c:203 get_platform_power_management_table() warn: struct type mismatch 'phm_ppm_table vs _ATOM_Tonga_PPM_Table'
>
> Cc: Eric Huang <JinHuiEric.Huang at amd.com>
> Cc: Christian König <christian.koenig at amd.com>
> Cc: Alex Deucher <alexander.deucher at amd.com>
> Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam at amd.com>
Acked-by: Alex Deucher <alexander.deucher at amd.com>
> ---
> drivers/gpu/drm/amd/pm/powerplay/hwmgr/process_pptables_v1_0.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/process_pptables_v1_0.c b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/process_pptables_v1_0.c
> index f2a55c1413f5..17882f8dfdd3 100644
> --- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/process_pptables_v1_0.c
> +++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/process_pptables_v1_0.c
> @@ -200,7 +200,7 @@ static int get_platform_power_management_table(
> struct pp_hwmgr *hwmgr,
> ATOM_Tonga_PPM_Table *atom_ppm_table)
> {
> - struct phm_ppm_table *ptr = kzalloc(sizeof(ATOM_Tonga_PPM_Table), GFP_KERNEL);
> + struct phm_ppm_table *ptr = kzalloc(sizeof(*ptr), GFP_KERNEL);
> struct phm_ppt_v1_information *pp_table_information =
> (struct phm_ppt_v1_information *)(hwmgr->pptable);
>
> --
> 2.34.1
>
More information about the amd-gfx
mailing list