On Mon, Mar 16, 2026 at 06:01:58PM +0100, Andy Shevchenko wrote:
> strlcpy() and strlcat() are confusing APIs and the former one already gone
> from the kernel. In preparation to kill strlcat() replace it with the better
> alternative.

Yes please. There are a few places I looked at in the past that might
benefit from being changed to seq_buf or similar (where snprintf doesn't
cut it), but otherwise the removal of strlcat should be straight forward
and would be well appreciated. :)

> 
> Signed-off-by: Andy Shevchenko <[email protected]>

Reviewed-by: Kees Cook <[email protected]>

-Kees

> ---
>  drivers/acpi/processor_idle.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
> index 45b5d17443cf..498d88f5d5c9 100644
> --- a/drivers/acpi/processor_idle.c
> +++ b/drivers/acpi/processor_idle.c
> @@ -1010,9 +1010,7 @@ static bool combine_lpi_states(struct acpi_lpi_state 
> *local,
>       result->arch_flags = parent->arch_flags;
>       result->index = parent->index;
>  
> -     strscpy(result->desc, local->desc, ACPI_CX_DESC_LEN);
> -     strlcat(result->desc, "+", ACPI_CX_DESC_LEN);
> -     strlcat(result->desc, parent->desc, ACPI_CX_DESC_LEN);
> +     snprintf(result->desc, ACPI_CX_DESC_LEN, "%s+%s", local->desc, 
> parent->desc);
>       return true;
>  }
>  
> -- 
> 2.50.1
> 

-- 
Kees Cook

Reply via email to