Re: Questionable code in pci_sal_read

From: David Mosberger <davidm_at_napali.hpl.hp.com>
Date: 2005-01-26 04:44:43
>>>>> 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

-
To unsubscribe from this list: send the line "unsubscribe linux-ia64" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Received on Tue Jan 25 12:45:05 2005

This archive was generated by hypermail 2.1.8 : 2005-08-02 09:20:35 EST