Commit d116db18 authored by Mario Limonciello's avatar Mario Limonciello Committed by Alex Deucher
Browse files

drm/amd: Fix an out of bounds error in BIOS parser



The array is hardcoded to 8 in atomfirmware.h, but firmware provides
a bigger one sometimes. Deferencing the larger array causes an out
of bounds error.

commit 4fc1ba4a ("drm/amd/display: fix array index out of bound error
in bios parser") fixed some of this, but there are two other cases
not covered by it.  Fix those as well.

Reported-by: default avatar <erhard_f@mailbox.org>
Link: https://bugzilla.kernel.org/show_bug.cgi?id=214853
Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2473


Signed-off-by: default avatarMario Limonciello <mario.limonciello@amd.com>
Reviewed-by: default avatarHarry Wentland <harry.wentland@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 9dce8c2a
Loading
Loading
Loading
Loading
+2 −5
Original line number Diff line number Diff line
@@ -515,11 +515,8 @@ static enum bp_result get_gpio_i2c_info(
	info->i2c_slave_address = record->i2c_slave_addr;

	/* TODO: check how to get register offset for en, Y, etc. */
	info->gpio_info.clk_a_register_index =
			le16_to_cpu(
			header->gpio_pin[table_index].data_a_reg_index);
	info->gpio_info.clk_a_shift =
			header->gpio_pin[table_index].gpio_bitshift;
	info->gpio_info.clk_a_register_index = le16_to_cpu(pin->data_a_reg_index);
	info->gpio_info.clk_a_shift = pin->gpio_bitshift;

	return BP_RESULT_OK;
}