drm/amd/powerplay: implement smu7 hwmgr to manager asics with smu ip version 7.
Subsystems (2)
Hello Rex Zhu,
The patch 599a7e9fe1b6: "drm/amd/powerplay: implement smu7 hwmgr to manager asics with smu ip version 7." from Sep 9, 2016, leads to the following static checker warning:
drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/smu7_hwmgr.c:2125 smu7_patch_limits_vddc() warn: passing casted pointer '&tab->vddc' to 'smu7_patch_ppt_v0_with_vdd_leakage()' 16 vs 32.
drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/smu7_hwmgr.c
2119 static int smu7_patch_limits_vddc(struct pp_hwmgr *hwmgr,
2120 struct phm_clock_and_voltage_limits *tab)
2121 {
2122 struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend);
2123
2124 if (tab) {
2125 smu7_patch_ppt_v0_with_vdd_leakage(hwmgr, (uint32_t *)&tab->vddc,
2126 &data->vddc_leakage);
This call corrupts vddci.
2127 smu7_patch_ppt_v0_with_vdd_leakage(hwmgr, (uint32_t *)&tab->vddci,
2128 &data->vddci_leakage);
But that's fine since we immediately overwrite it here. But unfortunately this call corrupt tab->vddgfx.
2129 }
2130
2131 return 0;
2132 }
regards,
dan carpenter
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 19 lines · Dan Carpenter
Hello Rex Zhu,
The patch
599a7e9fe1b6: "drm/amd/powerplay: implement smu7 hwmgr to manager asics with smu ip version 7." from Sep 9, 2016, leads to the following static checker warning:drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/smu7_hwmgr.c:2125 smu7_patch_limits_vddc() warn: passing casted pointer '&tab->vddc' to 'smu7_patch_ppt_v0_with_vdd_leakage()' 16 vs 32.
drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/smu7_hwmgr.c
2119 static int smu7_patch_limits_vddc(structpp_hwmgr*hwmgr,
2120 structphm_clock_and_voltage_limits*tab)
2121 {
2122 structsmu7_hwmgr*data = (structsmu7_hwmgr*)(hwmgr->backend);
2123
2124 if (tab) {
2125 smu7_patch_ppt_v0_with_vdd_leakage(hwmgr, (uint32_t*)&tab->vddc,
2126&data->vddc_leakage);
Quoted 7 lines
This call corrupts vddci.
2127 smu7_patch_ppt_v0_with_vdd_leakage(hwmgr, (
uint32_t*)&tab->vddci,
2128&data->vddci_leakage);But that's fine since we immediately overwrite it here. But unfortunately this call corrupt
tab->vddgfx.
Thanks. Should be fixed in the attached patch.
Alex
Quoted 6 lines
2129 }
2130
2131 return 0;
2132 }
Quoted 6 lines
regards,
dan carpenter
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
From 2e94250b99ceb556335a34a01ea9d36cd9ce6cec Mon Sep 17 00:00:00 2001
From: Alex Deucher <[email protected]>
Date: Fri, 14 Oct 2016 11:11:06 -0400
Subject: [PATCH] drm/amdgpu/powerplay/smu7: fix static checker warning
Casting of voltage values to a larger size results in overwriting adjacent memory in the structure.
--- drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +8 -5
@@ -2133,15 +2133,18 @@ static int smu7_patch_acp_vddc(struct pp_hwmgr *hwmgr, }static int smu7_patch_limits_vddc (struct pp_hwmgr *hwmgr, -struct phm_clock_and_voltage_limits *tab) +struct phm_clock_and_voltage_limits *tab) { +uint32_t vddc, vddci;struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend);if (tab) { -smu7_patch_ppt_v0_with_vdd_leakage (hwmgr, (uint32_t *)&tab->vddc, - &data->vddc_leakage); -smu7_patch_ppt_v0_with_vdd_leakage (hwmgr, (uint32_t *)&tab->vddci, - &data->vddci_leakage); +smu7_patch_ppt_v0_with_vdd_leakage (hwmgr, &vddc, + &data->vddc_leakage); + tab->vddc = vddc; +smu7_patch_ppt_v0_with_vdd_leakage (hwmgr, &vddci, + &data->vddci_leakage); + tab->vddci = vddci; }return 0 ;
Signature · 1 line
2.5.5
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Thanks, Alex.
Patch was Reviewed-by: Rex Zhu <[email protected]>
Best Regards
Rex
-----Original Message-----
From: Alex Deucher [mailto:[email protected]]
Sent: Friday, October 14, 2016 11:14 PM
To: Dan Carpenter
Cc: Zhu, Rex; Maling list - DRI developers
Subject: Re: [bug report] drm/amd/powerplay: implement smu7 hwmgr to manager asics with smu ip version 7.
Quoted 19 lines · Dan Carpenter
Hello Rex Zhu,
The patch
599a7e9fe1b6: "drm/amd/powerplay: implement smu7 hwmgr to manager asics with smu ip version 7." from Sep 9, 2016, leads to the following static checker warning:drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/smu7_hwmgr.c:2125 smu7_patch_limits_vddc() warn: passing casted pointer '&tab->vddc' to 'smu7_patch_ppt_v0_with_vdd_leakage()' 16 vs 32.
drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/smu7_hwmgr.c
2119 static int smu7_patch_limits_vddc(structpp_hwmgr*hwmgr,
2120 structphm_clock_and_voltage_limits*tab)
2121 {
2122 structsmu7_hwmgr*data = (structsmu7_hwmgr*)(hwmgr->backend);
2123
2124 if (tab) {
2125 smu7_patch_ppt_v0_with_vdd_leakage(hwmgr, (uint32_t*)&tab->vddc,
2126&data->vddc_leakage);
Quoted 7 lines
This call corrupts vddci.
2127 smu7_patch_ppt_v0_with_vdd_leakage(hwmgr, (
uint32_t*)&tab->vddci,
2128&data->vddci_leakage);But that's fine since we immediately overwrite it here. But unfortunately this call corrupt
tab->vddgfx.
Thanks. Should be fixed in the attached patch.
Alex
Quoted 6 lines
2129 }
2130
2131 return 0;
2132 }
Quoted 6 lines
regards,
dan carpenter
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel