Skip to content

Commit 1357b21

Browse files
Alex Hungalexdeucher
authored andcommitted
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: Rodrigo Siqueira <[email protected]> Acked-by: Wayne Lin <[email protected]> Signed-off-by: Alex Hung <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 5396a70 commit 1357b21

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/gpu/drm/amd/display/dc/core/dc_resource.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3187,6 +3187,9 @@ static struct audio *find_first_free_audio(
31873187
{
31883188
int i, available_audio_count;
31893189

3190+
if (id == ENGINE_ID_UNKNOWN)
3191+
return NULL;
3192+
31903193
available_audio_count = pool->audio_count;
31913194

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

0 commit comments

Comments
 (0)