From: Ben Hutchings <bhutchings@solarflare.com>
To: Stephen Hemminger <shemminger@vyatta.com>
Cc: Jeff Garzik <jgarzik@pobox.com>,
Jesse Barnes <jbarnes@virtuousgeek.org>,
netdev@vger.kernel.org, linux-pci@vger.kernel.org,
Ivan Vecera <ivecera@redhat.com>
Subject: Re: [PATCH 2/9] PCI: revise VPD access interface (rev3)
Date: Thu, 25 Sep 2008 18:58:52 +0100 [thread overview]
Message-ID: <1222365532.8641.86.camel@achroite> (raw)
In-Reply-To: <20080925165223.268510251@vyatta.com>
On Thu, 2008-09-25 at 09:48 -0700, Stephen Hemminger wrote:
[...]
> -static int pci_vpd_pci22_write(struct pci_dev *dev, int pos, int size,
> - const char *buf)
> +static ssize_t pci_vpd_pci22_write(struct pci_dev *dev, loff_t pos, size_t count,
> + const void *arg)
> {
> struct pci_vpd_pci22 *vpd =
> container_of(dev->vpd, struct pci_vpd_pci22, base);
> - u32 val;
> + const u8 *buf = arg;
> + loff_t end = pos + count;
count should be (count & ~3)
> int ret = 0;
>
> - if (pos < 0 || pos > vpd->base.len || pos & 3 ||
> - size > vpd->base.len - pos || size < 4)
> + if (pos > vpd->base.len || pos & 3)
> return -EINVAL;
Why did you remove the tests for pos < 0 and size > vpd->base.len - pos?
I know write_vpd_attr() checks these but you're about to add other
callers.
[...]
> out:
> mutex_unlock(&vpd->lock);
> - if (ret < 0)
> - return ret;
> -
> - return 4;
> + return ret ? ret : count;
> }
[...]
count should be (count & ~3)
Alternately you could treat (count & 3) != 0 as invalid.
Ben.
--
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
next prev parent reply other threads:[~2008-09-25 17:58 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-25 16:48 [PATCH 0/9] PCI vpd patches (rev4) Stephen Hemminger
2008-09-25 16:48 ` [PATCH 1/9] PCI: vpd handle longer delays in access (rev3) Stephen Hemminger
2008-09-25 18:54 ` Matthew Wilcox
2008-09-25 16:48 ` [PATCH 2/9] PCI: revise VPD access interface (rev3) Stephen Hemminger
2008-09-25 17:58 ` Ben Hutchings [this message]
2008-09-25 16:48 ` [PATCH 3/9] PCI: add interface to set visible size of VPD (rev3) Stephen Hemminger
2008-09-25 17:22 ` Jeff Garzik
2008-09-25 17:49 ` Ben Hutchings
2008-09-25 16:48 ` [PATCH 4/9] sky2: set VPD size Stephen Hemminger
2008-09-25 16:48 ` [PATCH 5/9] sky2: move VPD display into debug interface Stephen Hemminger
2008-09-25 16:48 ` [PATCH 6/9] sky2: remove VPD eeprom Stephen Hemminger
2008-09-25 16:48 ` [PATCH 7/9] skge: set VPD size Stephen Hemminger
2008-09-25 16:48 ` [PATCH 8/9] skge: add VPD display into debug interface Stephen Hemminger
2008-09-25 17:23 ` Jeff Garzik
2008-09-25 16:49 ` [PATCH 9/9] skge: remove VPD eeprom Stephen Hemminger
-- strict thread matches above, loose matches on Subject: below --
2008-09-09 18:20 [PATCH 0/9] PCI VPD related patches Stephen Hemminger
2008-09-09 18:20 ` [PATCH 2/9] PCI: revise VPD access interface (rev3) Stephen Hemminger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1222365532.8641.86.camel@achroite \
--to=bhutchings@solarflare.com \
--cc=ivecera@redhat.com \
--cc=jbarnes@virtuousgeek.org \
--cc=jgarzik@pobox.com \
--cc=linux-pci@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=shemminger@vyatta.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).