[PATCH v2 07/18] virtio: pci: Read entire capability into memory

Bin Meng bmeng.cn at gmail.com
Wed Apr 13 15:14:18 CEST 2022


On Wed, Mar 30, 2022 at 12:59 AM Andrew Scull <ascull at google.com> wrote:
>
> 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 at google.com>
> ---
>  drivers/virtio/virtio_pci_modern.c | 72 ++++++++++++++++--------------
>  1 file changed, 38 insertions(+), 34 deletions(-)
>

Reviewed-by: Bin Meng <bmeng.cn at gmail.com>


More information about the U-Boot mailing list