]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/amd/display: Skip inactive planes within ModeSupportAndSystemConfiguration
authorHersen Wu <hersenxs.wu@amd.com>
Fri, 26 Apr 2024 20:39:37 +0000 (16:39 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 2 May 2024 20:18:18 +0000 (16:18 -0400)
[Why]
Coverity reports Memory - illegal accesses.

[How]
Skip inactive planes.

Reviewed-by: Alex Hung <alex.hung@amd.com>
Acked-by: Tom Chung <chiahsuan.chung@amd.com>
Signed-off-by: Hersen Wu <hersenxs.wu@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/dml/display_mode_vba.c

index 9a3ded31119529d550385c41543b77cc025c6789..85453bbb4f9b1347836904a5604ee002d40592d0 100644 (file)
@@ -1099,8 +1099,13 @@ void ModeSupportAndSystemConfiguration(struct display_mode_lib *mode_lib)
 
        // Total Available Pipes Support Check
        for (k = 0; k < mode_lib->vba.NumberOfActivePlanes; ++k) {
-               total_pipes += mode_lib->vba.DPPPerPlane[k];
                pipe_idx = get_pipe_idx(mode_lib, k);
+               if (pipe_idx == -1) {
+                       ASSERT(0);
+                       continue; // skip inactive planes
+               }
+               total_pipes += mode_lib->vba.DPPPerPlane[k];
+
                if (mode_lib->vba.cache_pipes[pipe_idx].clks_cfg.dppclk_mhz > 0.0)
                        mode_lib->vba.DPPCLK[k] = mode_lib->vba.cache_pipes[pipe_idx].clks_cfg.dppclk_mhz;
                else