From: Bjorn Helgaas <bjorn.helgaas@hp.com>
To: linux-ia64@vger.kernel.org
Subject: RE: Questionable code in pci_sal_read
Date: Tue, 25 Jan 2005 21:22:37 +0000 [thread overview]
Message-ID: <1106688157.6880.22.camel@eeyore> (raw)
In-Reply-To: <jek6q1o7p2.fsf@sykes.suse.de>
On Tue, 2005-01-25 at 12:47 -0800, Luck, Tony wrote:
> >Ah, yes, that looks wrong. Looks like the check for (seg > 255) came
> >from the original pci_sal_read(). The original pci_sal_ext_read() did
> >check for (seg > 65535). My bad.
> >
> >Thanks for catching this.
>
>
> So you (and Matthew Wilcox) are advocating this change?
>
> === arch/ia64/pci/pci.c 1.66 vs edited ==> --- 1.66/arch/ia64/pci/pci.c 2005-01-22 14:42:51 -08:00
> +++ edited/arch/ia64/pci/pci.c 2005-01-25 12:42:49 -08:00
> @@ -71,7 +71,7 @@
> u64 addr, mode, data = 0;
> int result = 0;
>
> - if ((seg > 255) || (bus > 255) || (devfn > 255) || (reg > 4095))
> + if ((seg > 65535) || (bus > 255) || (devfn > 255) || (reg > 4095))
> return -EINVAL;
>
> if ((seg | reg) <= 255) {
>
> "seg", "bus", etc. are all "int" ... should we be extra paranoid
> and check for negative values (or change the definitions to unsigned),
> or is that over the top?
We should definitely change them to unsigned; it's a real problem
that has bitten us already. In fact, I wonder if Andreas was
looking at this code as a result of the bug I opened yesterday ;-)
I'm testing a patch right now, and it includes the "seg > 65535"
change as well.
prev parent reply other threads:[~2005-01-25 21:22 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-01-25 15:21 Questionable code in pci_sal_read Andreas Schwab
2005-01-25 15:27 ` Matthew Wilcox
2005-01-25 17:44 ` David Mosberger
2005-01-25 20:47 ` Luck, Tony
2005-01-25 21:15 ` Matthew Wilcox
2005-01-25 21:22 ` Bjorn Helgaas [this message]
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=1106688157.6880.22.camel@eeyore \
--to=bjorn.helgaas@hp.com \
--cc=linux-ia64@vger.kernel.org \
/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