Hi, On Tue, Jun 16, 2026 at 9:45 AM Naveen Kumar Chaudhary <[email protected]> wrote: > > kdb_main.c defines CMD_BUFLEN as 200 (for command history buffers), > while kdb_io.c defines it as 256 (for kdb_prompt_str). The snprintf() > filling kdb_prompt_str incorrectly used the local CMD_BUFLEN (200), > truncating the prompt unnecessarily. Use sizeof(kdb_prompt_str) to > always match the actual buffer size. > > Signed-off-by: Naveen Kumar Chaudhary <[email protected]> > --- > kernel/debug/kdb/kdb_main.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/kernel/debug/kdb/kdb_main.c b/kernel/debug/kdb/kdb_main.c > index ddce56b47b25..571e9e61b40e 100644 > --- a/kernel/debug/kdb/kdb_main.c > +++ b/kernel/debug/kdb/kdb_main.c > @@ -1265,8 +1265,8 @@ static int kdb_local(kdb_reason_t reason, int error, > struct pt_regs *regs, > > do_full_getstr: > /* PROMPT can only be set if we have MEM_READ permission. */ > - snprintf(kdb_prompt_str, CMD_BUFLEN, kdbgetenv("PROMPT"), > - raw_smp_processor_id()); > + snprintf(kdb_prompt_str, sizeof(kdb_prompt_str), > + kdbgetenv("PROMPT"), raw_smp_processor_id());
Hmmm, I don't think so. My compiler yells at me for that: Invalid application of 'sizeof' to an incomplete type 'char[]'clang(sizeof_alignof_incomplete_or_sizeless_type) ...which makes sense since the variable is defined in a different source file and the header has: kernel/debug/kdb/kdb_private.h:extern char kdb_prompt_str[]; So there's a bug to fix, but I don't think your fix is quite right. Instead, maybe you should have a single #define that's in a header and used by both files? -Doug _______________________________________________ Kgdb-bugreport mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/kgdb-bugreport
