device/pci_rom.c: Fix out of bounds read

run_rom->data is a uint16_t, so use the appropriate read function.

Change-Id: Icc14421412885495df90c90ed7da6e7d2eba4182
Signed-off-by: Jacob Garber <jgarber1@ualberta.ca>
Found-by: Coverity CID 1402145
Reviewed-on: https://review.coreboot.org/c/coreboot/+/34372
Reviewed-by: Marshall Dawson <marshalldawson3rd@gmail.com>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Jacob Garber 2019-07-16 13:14:09 -06:00 committed by Patrick Georgi
parent 52f3bd158a
commit 7cfe68d965
1 changed files with 1 additions and 1 deletions

View File

@ -192,7 +192,7 @@ static struct rom_header *check_initialized(struct device *dev)
return NULL;
rom_data = (struct pci_data *)((u8 *)run_rom
+ read_le32(&run_rom->data));
+ read_le16(&run_rom->data));
if (read_le32(&rom_data->signature) == PCI_DATA_HDR
&& read_le16(&rom_data->device) == dev->device