Skip to contentSkip to conversation

fix buggy comparison in cpqphp_pci.c

PATCH In review Adrian Bunk 2 participants 2 messages Jun 21, 2003 – Jun 23, 2003 PCI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix buggy comparison in cpqphp_pci.c

Hi Greg,

I don't understand the code good enough to be sure my patch is correct, but the current code is definitely buggy:

0xFF is the maximum value for an u8, so tdevice < 0x100 is _always_ true.

cu
Adrian

drivers/pci/hotplug/cpqphp_pci.c renamed from drivers/pci/hotplug/cpqphp_pci.c.old +2 -2
@@ -198,7 +198,7 @@
 
 	ctrl->pci_bus->number = bus_num;
 
-	for (tdevice = 0; tdevice < 0x100; tdevice++) {
+	for (tdevice = 0; tdevice < 0xFF; tdevice++) {
 		//Scan for access first
 		if (PCI_RefinedAccessConfig(ctrl->pci_bus, tdevice, 0x08, &work) == -1)
 			continue;
@@ -210,7 +210,7 @@
 			return 0;
 		}
 	}
-	for (tdevice = 0; tdevice < 0x100; tdevice++) {
+	for (tdevice = 0; tdevice < 0xFF; tdevice++) {
 		//Scan for access first
 		if (PCI_RefinedAccessConfig(ctrl->pci_bus, tdevice, 0x08, &work) == -1)
 			continue;
#1 lore raw
Quoted 7 lines · Adrian Bunk

Hi Greg,

I don't understand the code good enough to be sure my patch is correct, but the current code is definitely buggy:

0xFF is the maximum value for an u8, so tdevice < 0x100 is _always_ true.

Nice catch, I've applied this.

thanks,

greg k-h