From 5b92b6bbeb5a5cde9a860dc3eb5916446445dd20 Mon Sep 17 00:00:00 2001 From: Srinivasan Shanmugam Date: Fri, 10 Jul 2026 20:06:33 +0530 Subject: [PATCH] drm/amd/display: Run FP-disabled MST stub test only without DC FP dm_mst_test_fp_guarded_public_stubs() passes NULL arguments to dm_dp_mst_is_port_support_mode() to test the stub implementation when CONFIG_DRM_AMD_DC_FP is disabled. However, this test is always registered. When CONFIG_DRM_AMD_DC_FP is enabled, the real implementation is used instead of the stub. The real implementation expects valid pointers, so passing NULL can lead to a NULL pointer dereference. Register this test only when CONFIG_DRM_AMD_DC_FP is disabled. Reported-by: Dan Carpenter Cc: Bhawanpreet Lakha Cc: Alex Hung Cc: George Zhang Cc: Roman Li Cc: Tom Chung Cc: Aurabindo Pillai Signed-off-by: Srinivasan Shanmugam Reviewed-by: Alex Hung Signed-off-by: Alex Deucher --- .../amd/display/amdgpu_dm/tests/amdgpu_dm_mst_types_test.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_mst_types_test.c b/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_mst_types_test.c index 3a663ee0ca2bf..eaffff61129e3 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_mst_types_test.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_mst_types_test.c @@ -1015,6 +1015,7 @@ static void dm_mst_test_detect_unregistered(struct kunit *test) (int)connector_status_disconnected); } +#if !defined(CONFIG_DRM_AMD_DC_FP) /** * dm_mst_test_fp_guarded_public_stubs - Test FP-off public fallbacks * @test: KUnit test context @@ -1027,6 +1028,7 @@ static void dm_mst_test_fp_guarded_public_stubs(struct kunit *test) KUNIT_EXPECT_EQ(test, dm_dp_mst_is_port_support_mode(NULL, NULL), (enum dc_status)DC_OK); } +#endif static struct kunit_case dm_mst_types_test_cases[] = { /* needs_dsc_aux_workaround tests */ @@ -1077,7 +1079,9 @@ static struct kunit_case dm_mst_types_test_cases[] = { /* dm_dp_mst_detect tests */ KUNIT_CASE(dm_mst_test_detect_unregistered), /* CONFIG_DRM_AMD_DC_FP disabled public paths */ +#if !defined(CONFIG_DRM_AMD_DC_FP) KUNIT_CASE(dm_mst_test_fp_guarded_public_stubs), +#endif {} }; -- 2.53.0