aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
diff options
context:
space:
mode:
authorTom Rix <[email protected]>2020-07-06 12:28:57 +0000
committerAlex Deucher <[email protected]>2020-07-08 13:04:25 +0000
commit99010fac8b8c1e4f8663cb8b55c1a6584f3b84ba (patch)
tree052d7293be54d32380b1a2ef03152b5d3f0b9d2c /drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
parentgpu/drm: Remove debug info about CPU address (diff)
downloadkernel-99010fac8b8c1e4f8663cb8b55c1a6584f3b84ba.tar.gz
kernel-99010fac8b8c1e4f8663cb8b55c1a6584f3b84ba.zip
drm/radeon: fix double free
clang static analysis flags this error drivers/gpu/drm/radeon/ci_dpm.c:5652:9: warning: Use of memory after it is freed [unix.Malloc] kfree(rdev->pm.dpm.ps[i].ps_priv); ^~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/gpu/drm/radeon/ci_dpm.c:5654:2: warning: Attempt to free released memory [unix.Malloc] kfree(rdev->pm.dpm.ps); ^~~~~~~~~~~~~~~~~~~~~~ problem is reported in ci_dpm_fini, with these code blocks. for (i = 0; i < rdev->pm.dpm.num_ps; i++) { kfree(rdev->pm.dpm.ps[i].ps_priv); } kfree(rdev->pm.dpm.ps); The first free happens in ci_parse_power_table where it cleans up locally on a failure. ci_dpm_fini also does a cleanup. ret = ci_parse_power_table(rdev); if (ret) { ci_dpm_fini(rdev); return ret; } So remove the cleanup in ci_parse_power_table and move the num_ps calculation to inside the loop so ci_dpm_fini will know how many array elements to free. Fixes: cc8dbbb4f62a ("drm/radeon: add dpm support for CI dGPUs (v2)") Signed-off-by: Tom Rix <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_job.c')
0 files changed, 0 insertions, 0 deletions