Questionable code in pci_sal_read

Andreas Schwab
2005-01-25T15:21:45Z

These are the first few lines in pci_sal_read:

if ((seg > 255) || (bus > 255) || (devfn > 255) || (reg > 4095))
return -EINVAL;

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

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

The lines come from this changeset:

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

Andreas.

--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."