Re: [PATCH net-next] devlink: Replace strlcat() with seq_buf

Simon Horman <[email protected]>
Newsgroups org.kernel.vger.linux-hardening,org.kernel.vger.linux-kernel,org.kernel.vger.netdev
Message-ID <[email protected]>
On Fri, Jul 03, 2026 at 10:49:08PM -0500, Ian Bridges wrote:
> In preparation for removing the strlcat() API[1], replace its uses in
> __devlink_compat_running_version().
> 
> The function accumulates a variable number of version strings into a
> fixed buffer, which is what seq_buf is for. The seq_buf is anchored at
> the end of any existing string in the buffer and each version string
> is appended with a single seq_buf_printf(). The output is unchanged,
> including under truncation.
> 
> Link: https://github.com/KSPP/linux/issues/370 [1]
> Signed-off-by: Ian Bridges <[email protected]>
> ---
> The patch was tested as follows, on top of net-next:
>  - x86_64 allmodconfig and allyesconfig builds of net/devlink/dev.o at
>    W=1 produce no warnings.
>  - A userspace comparison of the old and new construction ran with
>    randomized version lists and buffer contents across all buffer
>    fill levels. The outputs are byte-identical in every case,
>    including on overflow.
>  - The changed path was exercised in a QEMU guest through the ethtool
>    GDRVINFO ioctl against a netdevsim device, before and after the
>    change, with identical fw_version output.

Reviewed-by: Simon Horman <[email protected]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.