projects/linux·commit 719dfd59

powerpc/xmon: Use KSYM_NAME_LEN in array size

719dfd59 · Maninder Singh <[email protected]> · 2023-05-29 16:43:37 +05:30

kallsyms_lookup() which in turn calls kallsyms_lookup_buildid() writes
to index "KSYM_NAME_LEN - 1".

Thus the array passed as namebuf to kallsyms_lookup() should be
KSYM_NAME_LEN in size.

In xmon.c the array was defined to be "128" bytes directly, without
using KSYM_NAME_LEN. Commit b8a94bfb3395 ("kallsyms: increase maximum
kernel symbol length to 512") changed the value to 512, but missed
updating the xmon code.

Fixes: b8a94bfb3395 ("kallsyms: increase maximum kernel symbol length to 512")
Cc: [email protected] # v6.1+
Co-developed-by: Onkarnath <[email protected]>
Signed-off-by: Onkarnath <[email protected]>
Signed-off-by: Maninder Singh <[email protected]>
[mpe: Tweak change log wording and fix commit reference]
Signed-off-by: Michael Ellerman <[email protected]>
Link: https://msgid.link/[email protected]
Commit
719dfd5925e186e09a2a6f23016936ac436f3d78
Parents
9d2ccf00

Changes

1 files changed · +1 −1

FileStatusAddDelContent
arch/powerpc/xmon/xmon.cmodified+1−1View file

arch/powerpc/xmon/xmon.c

View file
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index 728d3c2..70c4c59 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -88,7 +88,7 @@ static unsigned long ndump = 64;
static unsigned long nidump = 16;
static unsigned long ncsum = 4096;
static int termch;
-static char tmpstr[128];
+static char tmpstr[KSYM_NAME_LEN];
static int tracing_enabled;
static long bus_error_jmp[JMP_BUF_LEN];