]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
drm/amd/display: Check link_res->hpo_dp_link_enc before using it
authorAlex Hung <alex.hung@amd.com>
Thu, 27 Jun 2024 22:45:39 +0000 (16:45 -0600)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 23 Jul 2024 21:37:14 +0000 (17:37 -0400)
[WHAT & HOW]
Functions dp_enable_link_phy and dp_disable_link_phy can pass link_res
without initializing hpo_dp_link_enc and it is necessary to check for
null before dereferencing.

This fixes 1 FORWARD_NULL issue reported by Coverity.

Fixes: 0beca868cde8 ("drm/amd/display: Check link_res->hpo_dp_link_enc before using it")
Reviewed-by: Rodrigo Siqueira <rodrigo.siqueira@amd.com>
Signed-off-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Aurabindo Pillai <aurabindo.pillai@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/link/hwss/link_hwss_hpo_dp.c

index d0148f10dfc0a1ceae94c2a88a3b013f5e42c701..cec68c5dba1322ff20159619c09449dc080ad933 100644 (file)
@@ -110,6 +110,11 @@ void enable_hpo_dp_link_output(struct dc_link *link,
                enum clock_source_id clock_source,
                const struct dc_link_settings *link_settings)
 {
+       if (!link_res->hpo_dp_link_enc) {
+               DC_LOG_ERROR("%s: invalid hpo_dp_link_enc\n", __func__);
+               return;
+       }
+
        if (link->dc->res_pool->dccg->funcs->set_symclk32_le_root_clock_gating)
                link->dc->res_pool->dccg->funcs->set_symclk32_le_root_clock_gating(
                                link->dc->res_pool->dccg,