> -----Original Message-----
> From: Intel-wired-lan <[email protected]> On Behalf
> Of Mauro Carvalho Chehab
> Sent: Wednesday, January 28, 2026 5:50 PM
> To: Jonathan Corbet <[email protected]>; Linux Doc Mailing List <linux-
> [email protected]>
> Cc: Mauro Carvalho Chehab <[email protected]>;
> [email protected]; [email protected]; linux-
> [email protected]; [email protected]; Peter Zijlstra
> <[email protected]>; Randy Dunlap <[email protected]>; Stephen
> Rothwell <[email protected]>
> Subject: [Intel-wired-lan] [PATCH v2 02/25] docs: kdoc_re: don't go
> past the end of a line
>
> The logic which checks if the line ends with ";" is currently
> broken: it may try to read past the buffer.
>
> Fix it by checking before trying to access line[pos].
>
> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
> Acked-by: Randy Dunlap <[email protected]>
> Tested-by: Randy Dunlap <[email protected]>
> ---
> tools/lib/python/kdoc/kdoc_re.py | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/lib/python/kdoc/kdoc_re.py
> b/tools/lib/python/kdoc/kdoc_re.py
> index 19e777e2c97e..a0402c065d3a 100644
> --- a/tools/lib/python/kdoc/kdoc_re.py
> +++ b/tools/lib/python/kdoc/kdoc_re.py
> @@ -265,7 +265,7 @@ class NestedMatch:
> out += new_sub
>
> # Drop end ';' if any
> - if line[pos] == ';':
> + if pos < len(line) and line[pos] == ';':
> pos += 1
>
> cur_pos = pos
> --
> 2.52.0
Reviewed-by: Aleksandr Loktionov <[email protected]>