summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Axboe <axboe@fb.com>2014-02-14 08:48:22 -0700
committerJens Axboe <axboe@fb.com>2014-02-14 08:48:22 -0700
commit81fa6e06408879509e005cbb192205b9125f7614 (patch)
tree24b9dce395cd7d6fe270302d8c5f8c0a5d912fdb
parent729fe3af470e258690a79ff6ffc4f0e4b313abc8 (diff)
downloadfio-81fa6e06408879509e005cbb192205b9125f7614.tar.gz
fio-81fa6e06408879509e005cbb192205b9125f7614.tar.bz2
Fix early termination of cpu id string
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>
-rw-r--r--arch/arch-x86-common.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/arch-x86-common.h b/arch/arch-x86-common.h
index 26a14a82..31aa79f1 100644
--- a/arch/arch-x86-common.h
+++ b/arch/arch-x86-common.h
@@ -54,13 +54,13 @@ static inline int arch_init_amd(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]);
- str[11] = '\0';
+ str[12] = '\0';
if (!strcmp(str, "GenuineIntel"))
tsc_reliable = arch_init_intel(level);
else if (!strcmp(str, "AuthenticAMD"))