On Sun, Apr 22, 2012 at 06:36:41PM +0200, Franco Fichtner wrote: > Just being paranoid... strncmp?
Why ? It's a terminated string vs a string literal, what do you wanna use as the third argument: strlen("AuthenticAmd") ? . 100% pointless. > And how about consolidating style while at it? "!" vs. "== 0" - see code bits > below change. > Consolidating how ? Are you suggesting we change all strcmp calls in kernel to use "== 0" ? Please. > Franco > > On 22.04.2012, at 15:12, "Christiano F. Haesbaert" <haesba...@openbsd.org> > wrote: > > > There's no need for doing that somewhat strange comparison, the rest > > of the code already uses cpu_vendor. > > > > ok ? > > > > Index: identcpu.c > > =================================================================== > > RCS file: /cvs/src/sys/arch/amd64/amd64/identcpu.c,v > > retrieving revision 1.35 > > diff -d -u -p -r1.35 identcpu.c > > --- identcpu.c 27 Mar 2012 02:23:04 -0000 1.35 > > +++ identcpu.c 22 Apr 2012 12:59:10 -0000 > > @@ -302,7 +302,6 @@ identifycpu(struct cpu_info *ci) > > u_int64_t last_tsc; > > u_int32_t dummy, val, pnfeatset; > > u_int32_t brand[12]; > > - u_int32_t vendor[4]; > > char mycpu_model[48]; > > int i, max; > > char *brandstr_from, *brandstr_to; > > @@ -433,11 +432,7 @@ identifycpu(struct cpu_info *ci) > > > > #endif > > > > - vendor[3] = 0; > > - CPUID(0, dummy, vendor[0], vendor[2], vendor[1]); /* yup, 0 2 1 */ > > - /* AuthenticAMD: h t u A i t n e */ > > - if (vendor[0] == 0x68747541 && vendor[1] == 0x69746e65 && > > - vendor[2] == 0x444d4163) /* DMAc */ > > + if (!strcmp(cpu_vendor, "AuthenticAMD")) > > amd64_errata(ci); > > > > if (strncmp(mycpu_model, "VIA Nano processor", 18) == 0) {