[PATCH] kdb: use sizeof(kdb_prompt_str) instead of mismatched CMD_BUFLEN

From: Naveen Kumar Chaudhary

Date: Tue Jun 16 2026 - 12:52:23 EST


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 <naveen.osdev@xxxxxxxxx>
---
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());

/*
* Fetch command from keyboard
--
2.43.0