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

From: Simon Horman

Date: Thu Jul 09 2026 - 12:35:36 EST


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 <icb@xxxxxxxxxxxx>
> ---
> 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 <horms@xxxxxxxxxx>