]> git.baikalelectronics.ru Git - uboot.git/commit
virtio: pci: Read entire capability into memory
authorAndrew Scull <ascull@google.com>
Thu, 21 Apr 2022 16:11:05 +0000 (16:11 +0000)
committerTom Rini <trini@konsulko.com>
Tue, 3 May 2022 19:50:45 +0000 (15:50 -0400)
commit898e5da7b320a256bb6537b4cb34a30f1461c308
tree6f5b3892e0a06fb938266a94e4efab9ac1a335f9
parent0b903119fec0790c30083e1a0c65b599037b6864
virtio: pci: Read entire capability into memory

Read the virtio PCI capability out of the device configuration space to
a struct rather than accessing fields directly from the configuration
space as they are needed. This both makes access to the fields easier
and avoids re-reading fields.

Re-reading fields could result in time-of-check to time-of-use problems,
should the value in the configuration space change. The range check of
the `bar` field and the later call to `dm_pci_read_bar32()` is an
example of where this could happen.

Signed-off-by: Andrew Scull <ascull@google.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
drivers/virtio/virtio_pci_modern.c