drm/amd/display/dc/calcs/dce_calcs: Fix a memleak in calculate_bandwidth()
Subsystems (3)
PATCH 1/1 drm/amd/display/dc/calcs/dce_calcs: Fix a memleak in calculate_bandwidth()
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.
---
The analysis employs differential checking to identify inconsistent security operations (e.g., checks or kfrees) between two code paths and confirms that the inconsistent operations are not recovered in the current function or the callers, so they constitute bugs.
Note that, as a bug found by static analysis, it can be a false positive or hard to trigger. Multiple researchers have cross-reviewed the bug.
drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c +2 -2
@@ -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); }/*******************************************************************************
Signature · 1 line
2.25.1
Alex Deucher
AppliedApplied. Thanks!
Alex
Quoted 46 lines · Zhou Qingyang
In
calculate_bandwidth(), the tagfree_sclkandfree_yclkare reversed, which could lead to a memory leak of yclk.Fix this bug by changing the location of
free_sclkandfree_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 2be8989d0fc2 ("drm/amd/display/dc/calcs/dce_calcs: Move some large variables from the stack to the heap")Signed-off-by Zhou Qingyang <[email protected]>---
The analysis employs differential checking to identify inconsistent security operations (e.g., checks or kfrees) between two code paths and confirms that the inconsistent operations are not recovered in the current function or the callers, so they constitute bugs.Note that, as a bug found by static analysis, it can be a false positive or hard to trigger. Multiple researchers have cross-reviewed the bug.
drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c +2
-3@@ -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); }/******************************************************************************* -- 2.25.1
Quoted 45 lines · Zhou Qingyang
In
calculate_bandwidth(), the tagfree_sclkandfree_yclkare reversed, which could lead to a memory leak of yclk.Fix this bug by changing the location of
free_sclkandfree_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 2be8989d0fc2 ("drm/amd/display/dc/calcs/dce_calcs: Move some large variables from the stack to the heap")Signed-off-by Zhou Qingyang <[email protected]>---
The analysis employs differential checking to identify inconsistent security operations (e.g., checks or kfrees) between two code paths and confirms that the inconsistent operations are not recovered in the current function or the callers, so they constitute bugs.Note that, as a bug found by static analysis, it can be a false positive or hard to trigger. Multiple researchers have cross-reviewed the bug.
drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c +2
-2@@ -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); }/******************************************************************************* Signature · 1 line
2.25.1
As stated before, umn.edu is still not allowed to contribute to the Linux kernel. Please work with your administration to resolve this issue.