NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

bin/38666: cpuctl segfaults on AMD Phenom quad-core processors



>Number:         38666
>Category:       bin
>Synopsis:       cpuctl segfaults on AMD Phenom quad-core processors
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu May 15 13:05:00 +0000 2008
>Originator:     Paul Goyette
>Release:        NetBSD 4.99.62
>Organization:
>Environment:
System: NetBSD quicky.whooppee.com 4.99.62 NetBSD 4.99.62 (QUICKY (ASUS M2N32 
WS) 2008-05-14 13:20:42) #1: Wed May 14 06:25:08 PDT 2008 
paul%speedy.whooppee.com@localhost:/build/obj/amd64/sys/arch/amd64/compile/QUICKY
 amd64
Architecture: x86_64
Machine: amd64
>Description:
Code limits an array index to sizeof(__arraycount(xxx)) rather than to the
actual value of __arraycount(xxx)
>How-To-Repeat:
Execute `cpuctl identify 0' on a AMD Phenom
>Fix:
quicky:arch {155} cvs diff i386.c
Index: i386.c
===================================================================
RCS file: /cvsroot/src/usr.sbin/cpuctl/arch/i386.c,v
retrieving revision 1.2
diff -u -p -r1.2 i386.c
--- i386.c      10 May 2008 15:01:05 -0000      1.2
+++ i386.c      15 May 2008 12:55:08 -0000
@@ -1258,7 +1258,7 @@ amd_family6_probe(struct cpu_info *ci)
        if (*cpu_brand_string == '\0')
                return;
 
-       for (i = 1; i < sizeof(__arraycount(amd_brand)); i++)
+       for (i = 1; i < __arraycount(amd_brand); i++)
        if ((p = strstr(cpu_brand_string, amd_brand[i])) != NULL) {
                        ci->ci_brand_id = i;
                        strlcpy(amd_brand_name, p, sizeof(amd_brand_name));



Home | Main Index | Thread Index | Old Index