]> git.dujemihanovic.xyz Git - u-boot.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)
commite7870c2cdccef3a3a8659995407280900323b9f5
tree6f5b3892e0a06fb938266a94e4efab9ac1a335f9
parent6a8cb878a24257ea64dfbd0f5493f07759eb5a0d
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