aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/kallsyms.c
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2007-07-17 07:03:51 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-17 13:23:03 -0400
commit9281acea6a3687ff0f262e0be31eac34895b95d7 (patch)
treef060d6e4f6a5da1c82bc789104683d39377a2e9a /scripts/kallsyms.c
parentb45d52797432bd6b5d9786dbda940eb8d0b9ed06 (diff)
kallsyms: make KSYM_NAME_LEN include space for trailing '\0'
KSYM_NAME_LEN is peculiar in that it does not include the space for the trailing '\0', forcing all users to use KSYM_NAME_LEN + 1 when allocating buffer. This is nonsense and error-prone. Moreover, when the caller forgets that it's very likely to subtly bite back by corrupting the stack because the last position of the buffer is always cleared to zero. This patch increments KSYM_NAME_LEN by one and updates code accordingly. * off-by-one bug in asm-powerpc/kprobes.h::kprobe_lookup_name() macro is fixed. * Where MODULE_NAME_LEN and KSYM_NAME_LEN were used together, MODULE_NAME_LEN was treated as if it didn't include space for the trailing '\0'. Fix it. Signed-off-by: Tejun Heo <htejun@gmail.com> Acked-by: Paulo Marques <pmarques@grupopie.com> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Paul Mackerras <paulus@samba.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'scripts/kallsyms.c')
-rw-r--r--scripts/kallsyms.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c
index 8b809b264d1..10b006694e5 100644
--- a/scripts/kallsyms.c
+++ b/scripts/kallsyms.c
@@ -31,7 +31,7 @@
31#include <string.h> 31#include <string.h>
32#include <ctype.h> 32#include <ctype.h>
33 33
34#define KSYM_NAME_LEN 127 34#define KSYM_NAME_LEN 128
35 35
36 36
37struct sym_entry { 37struct sym_entry {
@@ -254,7 +254,7 @@ static void write_src(void)
254 unsigned int i, k, off; 254 unsigned int i, k, off;
255 unsigned int best_idx[256]; 255 unsigned int best_idx[256];
256 unsigned int *markers; 256 unsigned int *markers;
257 char buf[KSYM_NAME_LEN+1]; 257 char buf[KSYM_NAME_LEN];
258 258
259 printf("#include <asm/types.h>\n"); 259 printf("#include <asm/types.h>\n");
260 printf("#if BITS_PER_LONG == 64\n"); 260 printf("#if BITS_PER_LONG == 64\n");