[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0c141713-c8d9-c910-e083-5dab67929c51@gmail.com>
Date: Wed, 13 Oct 2021 20:08:58 +0200
From: Heiner Kallweit <hkallweit1@...il.com>
To: Qian Cai <quic_qiancai@...cinc.com>,
Bjorn Helgaas <bhelgaas@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
David Miller <davem@...emloft.net>,
Raju Rangoju <rajur@...lsio.com>
Cc: "linux-pci@...r.kernel.org" <linux-pci@...r.kernel.org>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: Re: [PATCH 1/5] PCI/VPD: Add pci_read/write_vpd_any()
On 13.10.2021 16:22, Qian Cai wrote:
>
>
> 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:
>
Thanks for testing!
> --- 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.
>
This is intentional, but good catch.
Powered by blists - more mailing lists