]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/amd/display/dc/calcs/dce_calcs: Fix a memleak in calculate_bandwidth()
authorZhou Qingyang <zhou1615@umn.edu>
Mon, 24 Jan 2022 16:55:51 +0000 (00:55 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 25 Jan 2022 22:52:46 +0000 (17:52 -0500)
In calculate_bandwidth(), the tag free_sclk and free_yclk are reversed,
which could lead to a memory leak of yclk.

Fix this bug by changing the location of free_sclk and free_yclk.

This bug was found by a static analyzer.

Builds with 'make allyesconfig' show no new warnings,
and our static analyzer no longer warns about this code.

Fixes: 78ca86d4cfd2 ("drm/amd/display/dc/calcs/dce_calcs: Move some large variables from the stack to the heap")
Signed-off-by: Zhou Qingyang <zhou1615@umn.edu>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c

index ff5bb152ef494f96667cb941a7e1976578910571..e6ef36de082540f1a91985f800db41a16cf9e6b6 100644 (file)
@@ -2033,10 +2033,10 @@ static void calculate_bandwidth(
        kfree(surface_type);
 free_tiling_mode:
        kfree(tiling_mode);
-free_yclk:
-       kfree(yclk);
 free_sclk:
        kfree(sclk);
+free_yclk:
+       kfree(yclk);
 }
 
 /*******************************************************************************