drm/amd/display: Check gpio_id before used as array index
authorAlex Hung <alex.hung@amd.com>
Tue, 16 Apr 2024 22:40:00 +0000 (16:40 -0600)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 2 May 2024 20:18:16 +0000 (16:18 -0400)
commit2a5626eeb3b5eec7a36886f9556113dd93ec8ed6
treedb2e17c1d5b5851cbc45ad6729732381c0a92036
parent687fe329f18ab0ab0496b20ed2cb003d4879d931
drm/amd/display: Check gpio_id before used as array index

[WHY & HOW]
GPIO_ID_UNKNOWN (-1) is not a valid value for array index and therefore
should be checked in advance.

This fixes 5 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/gpio/gpio_service.c