drm/amd/display: fix array index out of bound error in bios parser
authorAurabindo Pillai <aurabindo.pillai@amd.com>
Wed, 2 Nov 2022 19:35:53 +0000 (15:35 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 31 Dec 2022 12:14:42 +0000 (13:14 +0100)
commit58dd11f624277cae00551e69b34df7c995f04b9b
tree33e2942288f412b75682887ffe76192342f48e83
parenta3cc41e05e8af340a2a759b168c29fffdb9194eb
drm/amd/display: fix array index out of bound error in bios parser

[ Upstream commit 4fc1ba4aa589ca267468ad23fedef37562227d32 ]

[Why&How]
Firmware headers dictate that gpio_pin array only has a size of 8. The
count returned from vbios however is greater than 8.

Fix this by not using array indexing but incrementing the pointer since
gpio_pin definition in atomfirmware.h is hardcoded to size 8

Reviewed-by: Martin Leung <Martin.Leung@amd.com>
Acked-by: Tom Chung <chiahsuan.chung@amd.com>
Signed-off-by: Aurabindo Pillai <aurabindo.pillai@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c