On 10/12/2021 4:26 PM, Heiner Kallweit wrote:
Thanks for the report! I could reproduce the issue, the following fixes
it for me. Could you please test whether it fixes the issue for you as well?
Yes, it works fine. BTW, in the original patch here:
--- a/drivers/pci/vpd.c
+++ b/drivers/pci/vpd.c
@@ -138,9 +138,10 @@ static int pci_vpd_wait(struct pci_dev *dev, bool set)
}
static ssize_t pci_vpd_read(struct pci_dev *dev, loff_t pos, size_t count,
- void *arg)
+ void *arg, bool check_size)
{
struct pci_vpd *vpd = &dev->vpd;
+ unsigned int max_len = check_size ? vpd->len : PCI_VPD_MAX_SIZE;
int ret = 0;
loff_t end = pos + count;
u8 *buf = arg;@@ -151,11 +152,11 @@ static ssize_t pci_vpd_read(struct pci_dev *dev, loff_t pos, size_t count,
if (pos < 0)
return -EINVAL;
- if (pos > vpd->len)
+ if (pos >= max_len)
return 0;
I am not sure if "pos >= max_len" is correct there, so just want to give you
a chance to double-check.