From 05b25ef40605e79c186a5005ea15c9d4af0d6291 Mon Sep 17 00:00:00 2001 From: jsg Date: Fri, 13 May 2022 03:13:31 +0000 Subject: [PATCH] drm/amd/display: Avoid reading audio pattern past AUDIO_CHANNELS_COUNT From Harry Wentland c10bab89a1bea395b2f6970529e38bef54ebf792 in linux 5.15.y/5.15.39 3dfe85fa87b2a26bdbd292b66653bba065cf9941 in mainline linux --- sys/dev/pci/drm/amd/display/dc/core/dc_link_dp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/pci/drm/amd/display/dc/core/dc_link_dp.c b/sys/dev/pci/drm/amd/display/dc/core/dc_link_dp.c index 4c1daf22d3f..15a4803d145 100644 --- a/sys/dev/pci/drm/amd/display/dc/core/dc_link_dp.c +++ b/sys/dev/pci/drm/amd/display/dc/core/dc_link_dp.c @@ -3118,7 +3118,7 @@ static void dp_test_get_audio_test_data(struct dc_link *link, bool disable_video &dpcd_pattern_type.value, sizeof(dpcd_pattern_type)); - channel_count = dpcd_test_mode.bits.channel_count + 1; + channel_count = min(dpcd_test_mode.bits.channel_count + 1, AUDIO_CHANNELS_COUNT); // read pattern periods for requested channels when sawTooth pattern is requested if (dpcd_pattern_type.value == AUDIO_TEST_PATTERN_SAWTOOTH || -- 2.20.1