From c4d0fb4ca3ad112ae020d3067d419b8067cf434e Mon Sep 17 00:00:00 2001 From: Old-Ding Date: Mon, 6 Jul 2026 04:48:26 +0800 Subject: [PATCH 1/2] tools: kconfig2html: Handle blank input lines read_line() removes a trailing newline and then checks g_line[len - 1] for a line-continuation backslash. A blank line leaves len at zero, so the continuation check reads before g_line. Return the empty line to the caller before checking for a continuation. kconfig_line() already skips empty lines, so parser behavior is unchanged. Signed-off-by: Old-Ding --- tools/kconfig2html.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/kconfig2html.c b/tools/kconfig2html.c index 9c973718a29db..1ec003ef505d2 100644 --- a/tools/kconfig2html.c +++ b/tools/kconfig2html.c @@ -702,6 +702,12 @@ static char *read_line(FILE *stream) g_line[len] = '\0'; } + if (len == 0) + { + g_lnptr = g_line; + return g_line; + } + /* Does this continue on the next line? Note that this check * could erroneoulsy combine two lines if a comment line ends with * a line continuation... Don't do that! From 9094795bbafa2ef44cccf009c3ea0f4e28f5e30b Mon Sep 17 00:00:00 2001 From: Old-Ding <35417409+Old-Ding@users.noreply.github.com> Date: Sat, 18 Jul 2026 10:07:36 +0800 Subject: [PATCH 2/2] tools: kconfig2html: Explain blank-line guard Explain why the guard runs before checking for a continuation marker. Signed-off-by: Old-Ding <35417409+Old-Ding@users.noreply.github.com> --- tools/kconfig2html.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/kconfig2html.c b/tools/kconfig2html.c index 1ec003ef505d2..001d9b96eddb9 100644 --- a/tools/kconfig2html.c +++ b/tools/kconfig2html.c @@ -702,6 +702,8 @@ static char *read_line(FILE *stream) g_line[len] = '\0'; } + /* A blank line has no continuation marker to inspect. */ + if (len == 0) { g_lnptr = g_line;