Commit 1357b216 authored by Alex Hung's avatar Alex Hung Committed by Alex Deucher
Browse files

drm/amd/display: Skip finding free audio for unknown engine_id



[WHY]
ENGINE_ID_UNKNOWN = -1 and can not be used as an array index. Plus, it
also means it is uninitialized and does not need free audio.

[HOW]
Skip and return NULL.

This fixes 2 OVERRUN issues reported by Coverity.

Reviewed-by: default avatarRodrigo Siqueira <rodrigo.siqueira@amd.com>
Acked-by: default avatarWayne Lin <wayne.lin@amd.com>
Signed-off-by: default avatarAlex Hung <alex.hung@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 5396a70e
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -3187,6 +3187,9 @@ static struct audio *find_first_free_audio(
{
	int i, available_audio_count;

	if (id == ENGINE_ID_UNKNOWN)
		return NULL;

	available_audio_count = pool->audio_count;

	for (i = 0; i < available_audio_count; i++) {