RE: Questionable code in pci_sal_read

From: Luck, Tony <tony.luck_at_intel.com>
Date: 2005-01-26 07:47:03
>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?

-Tony
-
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 15:51:52 2005

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