Fix early termination of cpu id string
authorJens Axboe <axboe@fb.com>
Fri, 14 Feb 2014 15:48:22 +0000 (08:48 -0700)
committerJens Axboe <axboe@fb.com>
Fri, 14 Feb 2014 15:48:22 +0000 (08:48 -0700)
Commit 2d60ad8e terminated the cpu id string at 12 chars,
but the output from cpuid is 12 chars. So we need one more
character, if we want it null terminated and strcmp()
working.

Signed-off-by: Jens Axboe <axboe@fb.com>
arch/arch-x86-common.h

index 26a14a82375001a24cbe4b3c7466c7e580138518..31aa79f1b573841f68575f49788a0cbbee9d1f0c 100644 (file)
@@ -54,13 +54,13 @@ static inline int arch_init_amd(unsigned int level)
 static inline int arch_init(char *envp[])
 {
        unsigned int level;
 static inline int arch_init(char *envp[])
 {
        unsigned int level;
-       char str[12];
+       char str[13];
 
        cpuid(0, &level, (unsigned int *) &str[0],
                         (unsigned int *) &str[8],
                         (unsigned int *) &str[4]);
 
 
        cpuid(0, &level, (unsigned int *) &str[0],
                         (unsigned int *) &str[8],
                         (unsigned int *) &str[4]);
 
-       str[11] = '\0';
+       str[12] = '\0';
        if (!strcmp(str, "GenuineIntel"))
                tsc_reliable = arch_init_intel(level);
        else if (!strcmp(str, "AuthenticAMD"))
        if (!strcmp(str, "GenuineIntel"))
                tsc_reliable = arch_init_intel(level);
        else if (!strcmp(str, "AuthenticAMD"))