aboutsummaryrefslogtreecommitdiff
path: root/sys/sys/pcpu.h
diff options
context:
space:
mode:
authorMarius Strobl <marius@FreeBSD.org>2011-07-09 18:47:51 +0000
committerMarius Strobl <marius@FreeBSD.org>2011-07-09 18:47:51 +0000
commit2a29286835afa64882398934ab7d85f0b2c806f9 (patch)
tree3b0a01a3e348bd83d12d0eb36c32dc203fcd1e83 /sys/sys/pcpu.h
parentd5a9ee9fb029d883dee0214a64a39e57db621505 (diff)
downloadsrc-2a29286835afa64882398934ab7d85f0b2c806f9.tar.gz
src-2a29286835afa64882398934ab7d85f0b2c806f9.zip
Fix the definition for PCPU_NAME_LEN, which is intended to fit
("CPU %d", cpuid) where cpuid <= MAXCPU. 1. sizeof(__XSTRING(MAXCPU) + 1) is a typo: typeof(__XSTRING(...) + 1) is 'char *', so sizeof() will return the size of the pointer, not the size of the string contents. The proper expression should be 'sizeof(__XSTRING(MAXCPU)) + 1'. 2. One should not add one, but substract it: sizeof() accounts for the trailing '\0' and we have two sizeof's, so the size of one '\0' should be substracted -- this will give the maximal string buffer length for CPU with its number, no less, no more. Submitted by: rea
Notes
Notes: svn path=/head/; revision=223893
Diffstat (limited to 'sys/sys/pcpu.h')
-rw-r--r--sys/sys/pcpu.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/sys/pcpu.h b/sys/sys/pcpu.h
index 2e69f818ac29..b25fcc89cb06 100644
--- a/sys/sys/pcpu.h
+++ b/sys/sys/pcpu.h
@@ -146,7 +146,7 @@ struct rm_queue {
struct rm_queue* volatile rmq_prev;
};
-#define PCPU_NAME_LEN (sizeof("CPU ") + sizeof(__XSTRING(MAXCPU) + 1))
+#define PCPU_NAME_LEN (sizeof("CPU ") + sizeof(__XSTRING(MAXCPU)) - 1)
/*
* This structure maps out the global data that needs to be kept on a