Subject: kern/30458: tlp(4) whitespace cleaning
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: Rui Paulo <rpaulo@netbsd-pt.org>
List: netbsd-bugs
Date: 06/07/2005 21:59:00
>Number:         30458
>Category:       kern
>Synopsis:       tlp(4) whitespace cleaning
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jun 07 21:59:00 +0000 2005
>Originator:     Rui Paulo
>Release:        N/A
>Organization:
>Environment:
N/A
>Description:
a whitespace is added to sc_name field in tlp_pci_dec_quirks() [sys/dev/pci/if_tlp_pci.c], but if the model is unknown, the whitespace doesn't get deleted (please see the source, i'm not going to explain C code here).
>How-To-Repeat:
problem noticed on freeshell.org:
tlp0: DEC , Ethernet address xx:xx:xx:xx:xx:xx
...
tlp1: DEC , Ethernet address xx:xx:xx:xx:xx:xx

>Fix:
we could apply the following diff, but it only removes the whitespace, it doesn't add any new device:

Index: if_tlp_pci.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/if_tlp_pci.c,v
retrieving revision 1.78
diff -u -r1.78 if_tlp_pci.c
--- if_tlp_pci.c        27 Feb 2005 00:27:33 -0000      1.78
+++ if_tlp_pci.c        7 Jun 2005 21:55:39 -0000
@@ -1012,6 +1012,8 @@
        if (memcmp(&sc->sc_srom[29], "DE500", 5) == 0 ||
            memcmp(&sc->sc_srom[29], "DE450", 5) == 0)
                memcpy(&sc->sc_name[4], &sc->sc_srom[29], 8);
+       else 
+               sc->sc_name[3] = '\0';
 }
 
 static void