Bug in "ide-pci.c"

Sean Estabrooks (estabrooks@home.com)
Fri, 6 Oct 2000 19:20:22 -0400


This is a multi-part message in MIME format.

------=_NextPart_000_023C_01C02FCA.78F62370
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

ide-pci.c bug:

ide_setup_pci_baseregs() may inappropriately report device as not =
capable of full native PCI:

// BUGGY LINE: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
if (pci_read_config_byte(dev, PCI_CLASS_PROG, &progif) || (progif & =
5) !=3D 5) {
// =3D=3D=3D=3D=3D=3D=3D=3D=3D TWO CONDITIONS USING PROGIF=20
if ((progif & 0xa) !=3D 0xa) {
printk("%s: device not capable of full native PCI mode\n", =
name);
return 1;
}

...

In the first line of code above there is no guarantee that the first =
condition will be executed
before the second. As progif is set to 0 before this block of code, the =
second test will always
be true if it is executed prior to the first.

------=_NextPart_000_023C_01C02FCA.78F62370
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

ide-pci.c bug:
 
ide_setup_pci_baseregs() may = inappropriately=20 report device as not capable of full native PCI:
 
//  BUGGY LINE: = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
    if = (pci_read_config_byte(dev,=20 PCI_CLASS_PROG, &progif) || (progif & 5) !=3D 5)=20 {
//  =3D=3D=3D=3D=3D=3D=3D=3D=3D   TWO = CONDITIONS USING PROGIF=20
       if = ((progif &=20 0xa) !=3D 0xa) {
          = printk("%s:=20 device not capable of full native PCI mode\n",=20 name);
          return=20 1;
      }
 
 ...
 
    In the first line of code above there is no = guarantee that the first condition will be executed
before the second.  As progif is set to 0 before this block of = code,=20 the second test will always
be true if it is executed prior to the first.
 
 
------=_NextPart_000_023C_01C02FCA.78F62370-- - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org Please read the FAQ at http://www.tux.org/lkml/