mirror of
https://github.com/openbsd/src.git
synced 2026-06-18 07:13:36 +02:00
drm/amd/display: Validate GPIO pin LUT table size before iterating
From Harry Wentland 7ca695b3122297b06a3ed605bbe1cd32c85d9f5a in linux-6.18.y/6.18.34 86d2b20644b11d21fe52c596e6e922b4590a3e3f in mainline linux
This commit is contained in:
@@ -492,6 +492,10 @@ static enum bp_result get_gpio_i2c_info(
|
||||
- sizeof(struct atom_common_table_header))
|
||||
/ sizeof(struct atom_gpio_pin_assignment);
|
||||
|
||||
if (!bios_get_image(&bp->base, DATA_TABLES(gpio_pin_lut),
|
||||
le16_to_cpu(header->table_header.structuresize)))
|
||||
return BP_RESULT_BADBIOSTABLE;
|
||||
|
||||
pin = (struct atom_gpio_pin_assignment *) header->gpio_pin;
|
||||
|
||||
for (table_index = 0; table_index < count; table_index++) {
|
||||
@@ -680,6 +684,11 @@ static enum bp_result bios_parser_get_gpio_pin_info(
|
||||
count = (le16_to_cpu(header->table_header.structuresize)
|
||||
- sizeof(struct atom_common_table_header))
|
||||
/ sizeof(struct atom_gpio_pin_assignment);
|
||||
|
||||
if (!bios_get_image(&bp->base, DATA_TABLES(gpio_pin_lut),
|
||||
le16_to_cpu(header->table_header.structuresize)))
|
||||
return BP_RESULT_BADBIOSTABLE;
|
||||
|
||||
for (i = 0; i < count; ++i) {
|
||||
if (header->gpio_pin[i].gpio_id != gpio_id)
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user