Manuel Ebner <[email protected]> writes:

> add a warning for strlcat()
>
> Signed-off-by: Manuel Ebner <[email protected]>
> ---
>  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

Reply via email to