]> git.ozlabs.org Git - ccan/commitdiff
cpuid: increment over size of cpu array, not just first one.
authorRusty Russell <rusty@rustcorp.com.au>
Fri, 4 Nov 2016 10:44:21 +0000 (21:14 +1030)
committerAhmed Samy <f.fallen45@gmail.com>
Fri, 4 Nov 2016 20:52:47 +0000 (20:52 +0000)
Found by PCS Suite.

Reported-by: Jon Griffiths
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Ahmed Samy <f.fallen45@gmail.com>
ccan/cpuid/cpuid.c

index 9a42d83e948d715232a1440f7f20271ca18a5ae7..4510def85b2dc0cb87fb0c780615a70da87fdd60 100644 (file)
@@ -237,7 +237,7 @@ cputype_t cpuid_get_cpu_type(void)
                uint32_t i;
 
                get_cpuid(CPUID_VENDORID, &i, &u.bufu32[0], &u.bufu32[2], &u.bufu32[1]);
-               for (i = 0; i < sizeof(c_cpunames) / sizeof(c_cpunames); ++i) {
+               for (i = 0; i < sizeof(c_cpunames) / sizeof(c_cpunames[0]); ++i) {
                        if (strncmp(c_cpunames[i], u.buf, 12) == 0) {
                                cputype = (cputype_t)i;
                                break;