Re: [PATCH 2/2] scripts: checkpatch.pl: add warning for strlcat()
From: Jonathan Corbet
Date: Mon May 11 2026 - 08:19:23 EST
Manuel Ebner <manuelebner@xxxxxxxxxxx> writes:
> add a warning for strlcat()
>
> Signed-off-by: Manuel Ebner <manuelebner@xxxxxxxxxxx>
> ---
> scripts/checkpatch.pl | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 0492d6afc9a1..ca1a8e67d529 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -7085,6 +7085,12 @@ sub process {
> "Prefer strscpy over strlcpy - see: https://github.com/KSPP/linux/issues/89\n" . $herecurr);
> }
>
> +# strlcat uses that should likely be
> + if ($line =~ /\bstrlcat\s*\(/ && !is_userspace($realfile)) {
> + WARN("STRLCAT",
> + "Prefer seq_buf_printf() over strlcat - see: https://github.com/KSPP/linux/issues/370\n" . $herecurr);
> + }
Using seq_buf_printf() requires switching over to the seq_buf API in
general, it is not just a simple substitution, so this advice may prove
unhelpful to many.
jon