Subject: kern/12815: Latest change to cardbus.c breaks cardbus
To: None <gnats-bugs@gnats.netbsd.org>
From: Dave Huang <khym@azeotrope.org>
List: netbsd-bugs
Date: 05/03/2001 04:46:12
>Number: 12815
>Category: kern
>Synopsis: Latest change to cardbus.c breaks cardbus
>Confidential: no
>Severity: serious
>Priority: high
>Responsible: kern-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu May 03 02:46:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: Dave Huang
>Release: NetBSD-1.5V as of May 2, 2001
>Organization:
Name: Dave Huang | Mammal, mammal / their names are called /
INet: khym@azeotrope.org | they raise a paw / the bat, the cat /
FurryMUCK: Dahan | dolphin and dog / koala bear and hog -- TMBG
Dahan: Hani G Y+C 25 Y++ L+++ W- C++ T++ A+ E+ S++ V++ F- Q+++ P+ B+ PA+ PL++
>Environment:
System: NetBSD fluff.metonymy.com 1.5V NetBSD 1.5V (NEWDELL) #9: Thu May 3 04:07:05 CDT 2001 khym@fluff.metonymy.com:/usr/src/sys/arch/i386/compile/NEWDELL i386
>Description:
Some code was moved around in version 1.32 of
sys/dev/cardbus/cardbus.c, which caused a variable to be used before it
was initialized. As a result (at least on my system), all cardbus cards
would get probed/attached 8 times:
tlp0 at cardbus1 dev 0 function 0: ADMtek AN985 Ethernet, pass 1.1
tlp0: Ethernet address 00:04:5a:09:0e:ac
ukphy0 at tlp0 phy 1: Generic IEEE 802.3u media interface
ukphy0: OUI 0x0010a9, model 0x0001, rev. 0
ukphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
tlp1 at cardbus1 dev 0 function 1: ADMtek AN985 Ethernet, pass 1.1
tlp1: Ethernet address 00:04:5a:09:0e:ac
ukphy1 at tlp1 phy 1: Generic IEEE 802.3u media interface
ukphy1: OUI 0x0010a9, model 0x0001, rev. 0
ukphy1: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
tlp2 at cardbus1 dev 0 function 2: ADMtek AN985 Ethernet, pass 1.1
tlp2: Ethernet address 00:04:5a:09:0e:ac
ukphy2 at tlp2 phy 1: Generic IEEE 802.3u media interface
ukphy2: OUI 0x0010a9, model 0x0001, rev. 0
ukphy2: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
tlp3 at cardbus1 dev 0 function 3: ADMtek AN985 Ethernet, pass 1.1
tlp3: Ethernet address 00:04:5a:09:0e:ac
ukphy3 at tlp3 phy 1: Generic IEEE 802.3u media interface
ukphy3: OUI 0x0010a9, model 0x0001, rev. 0
ukphy3: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
tlp4 at cardbus1 dev 0 function 4: ADMtek AN985 Ethernet, pass 1.1
tlp4: Ethernet address 00:04:5a:09:0e:ac
ukphy4 at tlp4 phy 1: Generic IEEE 802.3u media interface
ukphy4: OUI 0x0010a9, model 0x0001, rev. 0
ukphy4: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
tlp5 at cardbus1 dev 0 function 5: ADMtek AN985 Ethernet, pass 1.1
tlp5: Ethernet address 00:04:5a:09:0e:ac
ukphy5 at tlp5 phy 1: Generic IEEE 802.3u media interface
ukphy5: OUI 0x0010a9, model 0x0001, rev. 0
ukphy5: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
tlp6 at cardbus1 dev 0 function 6: ADMtek AN985 Ethernet, pass 1.1
tlp6: Ethernet address 00:04:5a:09:0e:ac
ukphy6 at tlp6 phy 1: Generic IEEE 802.3u media interface
ukphy6: OUI 0x0010a9, model 0x0001, rev. 0
ukphy6: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
tlp7 at cardbus1 dev 0 function 7: ADMtek AN985 Ethernet, pass 1.1
tlp7: Ethernet address 00:04:5a:09:0e:ac
ukphy7 at tlp7 phy 1: Generic IEEE 802.3u media interface
ukphy7: OUI 0x0010a9, model 0x0001, rev. 0
ukphy7: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
(manufacturer 0x0, product 0x0) Texas Instruments TSB12LV23 OHCI IEEE 1394 Host Controller (Firewire serial bus, interface 0x10) at cardbus2 dev 0 function 0 not configured
(manufacturer 0x0, product 0x0) Texas Instruments TSB12LV23 OHCI IEEE 1394 Host Controller (Firewire serial bus, interface 0x10) at cardbus2 dev 0 function 1 not configured
(manufacturer 0x0, product 0x0) Texas Instruments TSB12LV23 OHCI IEEE 1394 Host Controller (Firewire serial bus, interface 0x10) at cardbus2 dev 0 function 2 not configured
(manufacturer 0x0, product 0x0) Texas Instruments TSB12LV23 OHCI IEEE 1394 Host Controller (Firewire serial bus, interface 0x10) at cardbus2 dev 0 function 3 not configured
(manufacturer 0x0, product 0x0) Texas Instruments TSB12LV23 OHCI IEEE 1394 Host Controller (Firewire serial bus, interface 0x10) at cardbus2 dev 0 function 4 not configured
(manufacturer 0x0, product 0x0) Texas Instruments TSB12LV23 OHCI IEEE 1394 Host Controller (Firewire serial bus, interface 0x10) at cardbus2 dev 0 function 5 not configured
(manufacturer 0x0, product 0x0) Texas Instruments TSB12LV23 OHCI IEEE 1394 Host Controller (Firewire serial bus, interface 0x10) at cardbus2 dev 0 function 6 not configured
(manufacturer 0x0, product 0x0) Texas Instruments TSB12LV23 OHCI IEEE 1394 Host Controller (Firewire serial bus, interface 0x10) at cardbus2 dev 0 function 7 not configured
>How-To-Repeat:
Boot the kernel, then insert a single-function cardbus card.
>Fix:
"bhlc" is being used before it gets initialized... and gcc didn't notice
(isn't it supposed to, with the warnings that we have turned on?)
Index: cardbus.c
===================================================================
RCS file: /cvsroot/syssrc/sys/dev/cardbus/cardbus.c,v
retrieving revision 1.32
diff -u -r1.32 cardbus.c
--- cardbus.c 2001/04/25 09:29:36 1.32
+++ cardbus.c 2001/05/03 09:37:27
@@ -441,6 +441,7 @@
}
}
+ bhlc = cardbus_conf_read(cc, cf, tag, CARDBUS_BHLC_REG);
nfunction = CARDBUS_HDRTYPE_MULTIFN(bhlc) ? 8 : 1;
for (function = 0; function < nfunction; function++) {
>Release-Note:
>Audit-Trail:
>Unformatted: