drm/amd/display: Avoid reading audio pattern past AUDIO_CHANNELS_COUNT
authorjsg <jsg@openbsd.org>
Fri, 13 May 2022 03:13:31 +0000 (03:13 +0000)
committerjsg <jsg@openbsd.org>
Fri, 13 May 2022 03:13:31 +0000 (03:13 +0000)
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

index 4c1daf2..15a4803 100644 (file)
@@ -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 ||