drm/amd/display: Skip accessing array for unknown eng_id
authorAlex Hung <alex.hung@amd.com>
Tue, 23 Apr 2024 21:37:03 +0000 (15:37 -0600)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 2 May 2024 20:18:16 +0000 (16:18 -0400)
commit9419da172221eb1dd672bcbaa2e27bb5f8ca807a
tree5afd2bd637f1e4c98458494e28f8dcb925606970
parent0a8d25285feb68608acdf778983ee5f4d72707e8
drm/amd/display: Skip accessing array for unknown eng_id

[WHY]
ENGINE_ID_UNKNOWN (-1) is not a valid eng_id and not a valid array
index.

[HOW]
Check whether eng_id is unknown to avoid access array with negative
array index.

This fixes 4 OVERRUN issues reported by Coverity.

Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Acked-by: Tom Chung <chiahsuan.chung@amd.com>
Signed-off-by: Alex Hung <alex.hung@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/core/dc_link_enc_cfg.c