[PATCH 0/4] Add scnprintf_append() helper
From: Junrui Luo
Date: Fri Nov 07 2025 - 00:16:41 EST
This patch series was suggested by Takashi Iwai:
https://lore.kernel.org/all/874irai0ag.wl-tiwai@xxxxxxx/
It introduces a generic scnprintf_append() helper function
to lib/vsprintf.c and converts several users across different subsystems.
The pattern of building strings incrementally using strlen() + sprintf/snprintf()
appears frequently throughout the kernel. This helper simplifies such code,
and provides proper bounds checking.
Patch 1 adds the scnprintf_append() helper to the kernel's string library.
This is a common pattern where strings are built incrementally by appending
formatted text.
Patches 2-4 convert users in different subsystems:
- Patch 2: sound/isa/wavefront
- Patch 3: drivers/media/pci/ivtv
- Patch 4: drivers/net/ethernet/qlogic/qede
These conversions demonstrate the helper's applicability.
Junrui Luo (4):
lib/sprintf: add scnprintf_append() helper function
ALSA: wavefront: use scnprintf_append for longname construction
media: ivtv: use scnprintf_append for i2c adapter name
net: qede: use scnprintf_append for version string
drivers/media/pci/ivtv/ivtv-i2c.c | 3 +-
drivers/net/ethernet/qlogic/qede/qede_main.c | 7 ++--
include/linux/sprintf.h | 1 +
lib/vsprintf.c | 29 +++++++++++++++
sound/isa/wavefront/wavefront.c | 37 ++++++++++----------
5 files changed, 52 insertions(+), 25 deletions(-)
--
2.51.1.dirty