linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [2.5 patch] fix buggy comparison in cpqphp_pci.c
@ 2003-06-21 14:21 Adrian Bunk
  2003-06-23 22:19 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Adrian Bunk @ 2003-06-21 14:21 UTC (permalink / raw)
  To: greg; +Cc: linux-kernel

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

--- linux-2.5.72-mm2/drivers/pci/hotplug/cpqphp_pci.c.old	2003-06-21 16:16:14.000000000 +0200
+++ linux-2.5.72-mm2/drivers/pci/hotplug/cpqphp_pci.c	2003-06-21 16:16:45.000000000 +0200
@@ -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;

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [2.5 patch] fix buggy comparison in cpqphp_pci.c
  2003-06-21 14:21 [2.5 patch] fix buggy comparison in cpqphp_pci.c Adrian Bunk
@ 2003-06-23 22:19 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2003-06-23 22:19 UTC (permalink / raw)
  To: Adrian Bunk; +Cc: linux-kernel

On Sat, Jun 21, 2003 at 04:21:53PM +0200, Adrian Bunk wrote:
> 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-06-23 22:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-06-21 14:21 [2.5 patch] fix buggy comparison in cpqphp_pci.c Adrian Bunk
2003-06-23 22:19 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).