Re: Questionable code in pci_sal_read

David Mosberger
2005-01-25T17:44:43Z

>>>>> On Tue, 25 Jan 2005 16:21:45 +0100, Andreas Schwab <schwab@suse.de> said:

Andreas> These are the first few lines in pci_sal_read:
Andreas> if ((seg > 255) || (bus > 255) || (devfn > 255) || (reg > 4095))
Andreas> return -EINVAL;

Andreas> if ((seg | reg) <= 255) {

Andreas> When seg <= 255 then ((seg | reg) <= 255) is equivalent to
Andreas> (reg <= 255). But pci_sal_write only rejects (seg >
Andreas> 65535).

Andreas> The lines come from this changeset:

Andreas> http://linux.bkbits.net:8080/linux-2.6/cset%40407c8325V8ZAIQkFDRCUNpu5AXqG1g

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.

--david