summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Hung <alex.hung@amd.com>2024-04-22 19:34:17 +0300
committerAlex Deucher <alexander.deucher@amd.com>2024-05-02 23:18:17 +0300
commitefabdce3db9f3d306084c8946983f3d895810a6b (patch)
treeda7d6eb3b0d9f9c4837d14c83b7048ad47cab7ee
parentb38a4815f79b87efb196cd5121579fc51e29a7fb (diff)
downloadlinux-efabdce3db9f3d306084c8946983f3d895810a6b.tar.xz
drm/amd/display: Skip updating link encoder for unknown eng_id
This prevents accessing to negative index of link_encoders array. This fixes an OVERRUN issue reported by Coverity. Reviewed-by: Rodrigo Siqueira <rodrigo.siqueira@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>
-rw-r--r--drivers/gpu/drm/amd/display/dc/link/link_factory.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/display/dc/link/link_factory.c b/drivers/gpu/drm/amd/display/dc/link/link_factory.c
index cf22b8f28ba6..2c3f5d662285 100644
--- a/drivers/gpu/drm/amd/display/dc/link/link_factory.c
+++ b/drivers/gpu/drm/amd/display/dc/link/link_factory.c
@@ -390,7 +390,7 @@ static void link_destruct(struct dc_link *link)
* the dynamic assignment of link encoders to streams. Virtual links
* are not assigned encoder resources on creation.
*/
- if (link->link_id.id != CONNECTOR_ID_VIRTUAL) {
+ if (link->link_id.id != CONNECTOR_ID_VIRTUAL && link->eng_id != ENGINE_ID_UNKNOWN) {
link->dc->res_pool->link_encoders[link->eng_id - ENGINE_ID_DIGA] = NULL;
link->dc->res_pool->dig_link_enc_count--;
}