Reviewed-by: Alex Hung <[email protected]>
On 7/10/26 08:36, Srinivasan Shanmugam wrote:
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 <[email protected]>
Cc: Bhawanpreet Lakha <[email protected]>
Cc: Alex Hung <[email protected]>
Cc: George Zhang <[email protected]>
Cc: Roman Li <[email protected]>
Cc: Tom Chung <[email protected]>
Cc: Aurabindo Pillai <[email protected]>
Signed-off-by: Srinivasan Shanmugam <[email protected]>
---
.../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 3f591e3914d9..666fd2ad903e 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
{}
};