NetBSD-Bugs archive

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

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



The following reply was made to PR bin/38666; it has been noted by GNATS.

From: Paul Goyette <paul%whooppee.com@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: 
Subject: Re: bin/38666: cpuctl segfaults on AMD Phenom quad-core processors
Date: Thu, 15 May 2008 06:29:33 -0700 (PDT)

 Further inspection shows that there is a second occurrence of the same 
 bug - misuse of sizeof(__arraycount(xxx)) - the following diff addresses 
 both:
 
 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 13:27:48 -0000
 @@ -1197,7 +1197,7 @@ cpu_probe_features(struct cpu_info *ci)
        if (ci->ci_cpuid_level < 1)
                return;
 
 -      xmax = sizeof(__arraycount(i386_cpuid_cpus));
 +      xmax = __arraycount(i386_cpuid_cpus);
        for (i = 0; i < xmax; i++) {
                if (!strncmp((char *)ci->ci_vendor,
                    i386_cpuid_cpus[i].cpu_id, 12)) {
 @@ -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