diff options
author | Tom Rini <trini@konsulko.com> | 2022-08-27 08:05:15 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2022-08-27 08:05:15 -0400 |
commit | cd3872ce7e5bf90424a10eda0fe405d04e82adb9 (patch) | |
tree | 752f7cfa2ab81b6b3b0608030e4d9dd135b9cfb4 /drivers/pci/pci-uclass.c | |
parent | aea087a665c447dfb89bf2113cad74ad53fa17a0 (diff) | |
parent | 53a9f9ef879fbc9ae0e6bf5330d3817ebd726e5f (diff) |
Merge branch '2022-08-26-assorted-fixes'
- PCIe, NVMe and 2 UBIFS related fixes
Diffstat (limited to 'drivers/pci/pci-uclass.c')
-rw-r--r-- | drivers/pci/pci-uclass.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c index 2c85e78a136..16a6a699f92 100644 --- a/drivers/pci/pci-uclass.c +++ b/drivers/pci/pci-uclass.c @@ -286,6 +286,8 @@ int pci_bus_write_config(struct udevice *bus, pci_dev_t bdf, int offset, ops = pci_get_ops(bus); if (!ops->write_config) return -ENOSYS; + if (offset < 0 || offset >= 4096) + return -EINVAL; return ops->write_config(bus, bdf, offset, value, size); } @@ -364,8 +366,14 @@ int pci_bus_read_config(const struct udevice *bus, pci_dev_t bdf, int offset, struct dm_pci_ops *ops; ops = pci_get_ops(bus); - if (!ops->read_config) + if (!ops->read_config) { + *valuep = pci_conv_32_to_size(~0, offset, size); return -ENOSYS; + } + if (offset < 0 || offset >= 4096) { + *valuep = pci_conv_32_to_size(0, offset, size); + return -EINVAL; + } return ops->read_config(bus, bdf, offset, valuep, size); } |