[PATCH 00/28] Replace remaining strlcat() call sites with snprintf()/seq_buf()
From: Bill Wendling
Date: Tue Sep 15 2026 - 04:27:57 EST
strlcat() is deprecated: like strcat(), it requires re-scanning the
destination string from the beginning on every call, which is O(n^2)
when used to build up a string incrementally, and its truncation
behavior is easy to get wrong. See:
https://github.com/KSPP/linux/issues/370
This series removes the remaining strlcat() call sites in the tree
(plus the one inside fortify-string.h's strcat() implementation
itself), replacing each with snprintf(), scnprintf(), or the seq_buf()
API, whichever best fits the surrounding code.
One unrelated fix is included. While auditing drivers/edac/thunderx_edac.c
for its strlcat() conversion, "EDAC/thunderx: Fix stale error context in
thunderx_l2c_threaded_isr()" addresses a pre-existing bug, present since
the driver's original 2017 commit: thunderx_l2c_threaded_isr() computes
its ring "tail"/"ctx" once before its drain loop and never recomputes
them per iteration, unlike the analogous OCX handlers in the same file,
so it re-reports the same ring entry for every queued error instead of
draining the ring. It's split out as its own patch, ahead of the
strlcat() conversion for that file, so it can be reviewed and
backported independently of the rest of this series.
Bill Wendling (28):
ALSA: ac97: Refactor snd_ac97_get_name() to use snprintf()
sunrpc: Refactor rpc_sockaddr2uaddr() to use snprintf() instead of
strlcat()
ARM: atags: Replace strlcat() with snprintf() for cmdline extend
scsi: bfa: Use snprintf() in bfa_fcs_fabric_nsymb_init()
ALSA: usb-audio: Refactor usb_audio_make_longname() to use seq_buf
comedi: comedi_bond: Refactor strlcat() to seq_buf in do_dev_config()
scsi: bfa: Use snprintf() in bfa_fcs_fabric_psymb_init()
devlink: Refactor strlcat() to seq_buf in
__devlink_compat_running_version()
drm/dp_mst: Refactor build_mst_prop_path() to use seq_buf
of/fdt: Replace strlcat() with snprintf() in
early_init_dt_scan_chosen()
wifi: brcmfmac: Replace strlcat() with snprintf() in
brcmf_fw_alloc_request()
fortify: Convert strlcat() to snprintf() in strcat()
i40e: Replace strlcat() with snprintf() in i40e_nvm_version_str()
ALSA: usb-audio: Refactor append_ctl_name() to use snprintf()
orangefs: Use seq_buf for debug help string generation
pinctrl: samsung: Use snprintf() to construct pin bank names
MIPS: cmdline: Refactor bootcmdline_append() to use snprintf()
LoongArch: Refactor bootcmdline_init() to use seq_buf instead of
strlcat()
x86/setup: Use snprintf() to concatenate builtin and boot command
lines
parisc: Refactor strlcat() to seq_buf in setup_cmdline()
NFS: nfsroot: Refactor root_nfs_cat() to use snprintf()
media: si2165: Use snprintf() to format frontend name
Input: synaptics_usb - use seq_buf and snprintf() for name and phys
EDAC/thunderx: Fix stale error context in thunderx_l2c_threaded_isr()
EDAC/thunderx: Replace strlcat() with seq_buf
wifi: wil6210: Refactor resume_triggers2string() to use seq_buf
drm/xe/pf: Convert strlcat() to seq_buf in control_read()
drm/xe/pf: Refactor strlcat() to seq_buf in sched_group_engines_read()
arch/arm/kernel/atags_parse.c | 7 +-
arch/loongarch/kernel/setup.c | 22 +++--
arch/mips/kernel/setup.c | 21 ++++-
arch/parisc/kernel/setup.c | 16 ++--
arch/x86/kernel/setup.c | 8 +-
drivers/comedi/drivers/comedi_bond.c | 16 ++--
drivers/edac/thunderx_edac.c | 67 ++++++++++------
drivers/gpu/drm/display/drm_dp_mst_topology.c | 15 ++--
drivers/gpu/drm/xe/xe_gt_sriov_pf_debugfs.c | 24 +++---
drivers/input/mouse/synaptics_usb.c | 29 ++++---
drivers/media/dvb-frontends/si2165.c | 17 ++--
drivers/net/ethernet/intel/i40e/i40e.h | 15 +++-
drivers/net/wireless/ath/wil6210/wmi.c | 38 +++++----
.../broadcom/brcm80211/brcmfmac/firmware.c | 21 ++---
drivers/of/fdt.c | 11 ++-
drivers/pinctrl/samsung/pinctrl-samsung.c | 3 +-
drivers/scsi/bfa/bfa_fcs.c | 80 +++++--------------
fs/nfs/nfsroot.c | 11 ++-
fs/orangefs/orangefs-debugfs.c | 36 ++++-----
include/linux/fortify-string.h | 7 +-
net/devlink/dev.c | 8 +-
net/sunrpc/addr.c | 16 ++--
sound/pci/ac97/ac97_codec.c | 9 ++-
sound/usb/card.c | 58 +++++++++-----
sound/usb/mixer.c | 8 +-
25 files changed, 309 insertions(+), 254 deletions(-)
---
Cc: Russell King <linux@xxxxxxxxxxxxxxx>
Cc: Huacai Chen <chenhuacai@xxxxxxxxxx>
Cc: WANG Xuerui <kernel@xxxxxxxxxx>
Cc: Thomas Bogendoerfer <tsbogend@xxxxxxxxxxxxxxxx>
Cc: "James E.J. Bottomley" <James.Bottomley@xxxxxxxxxxxxxxxxxxxxx>
Cc: Helge Deller <deller@xxxxxx>
Cc: Thomas Gleixner <tglx@xxxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxxxxx>
Cc: Borislav Petkov <bp@xxxxxxxxx>
Cc: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>
Cc: x86@xxxxxxxxxx
Cc: "H. Peter Anvin" <hpa@xxxxxxxxx>
Cc: Ian Abbott <abbotti@xxxxxxxxx>
Cc: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>
Cc: Tony Luck <tony.luck@xxxxxxxxx>
Cc: Maarten Lankhorst <maarten.lankhorst@xxxxxxxxxxxxxxx>
Cc: Maxime Ripard <mripard@xxxxxxxxxx>
Cc: Thomas Zimmermann <tzimmermann@xxxxxxx>
Cc: David Airlie <airlied@xxxxxxxxx>
Cc: Simona Vetter <simona@xxxxxxxx>
Cc: Matthew Brost <matthew.brost@xxxxxxxxx>
Cc: "Thomas Hellström" <thomas.hellstrom@xxxxxxxxxxxxxxx>
Cc: Rodrigo Vivi <rodrigo.vivi@xxxxxxxxx>
Cc: Dmitry Torokhov <dmitry.torokhov@xxxxxxxxx>
Cc: Matthias Schwarzott <zzam@xxxxxxxxxx>
Cc: Mauro Carvalho Chehab <mchehab@xxxxxxxxxx>
Cc: Tony Nguyen <anthony.l.nguyen@xxxxxxxxx>
Cc: Przemek Kitszel <przemyslaw.kitszel@xxxxxxxxx>
Cc: Andrew Lunn <andrew+netdev@xxxxxxx>
Cc: "David S. Miller" <davem@xxxxxxxxxxxxx>
Cc: Eric Dumazet <edumazet@xxxxxxxxxx>
Cc: Jakub Kicinski <kuba@xxxxxxxxxx>
Cc: Paolo Abeni <pabeni@xxxxxxxxxx>
Cc: Arend van Spriel <arend.vanspriel@xxxxxxxxxxxx>
Cc: Rob Herring <robh@xxxxxxxxxx>
Cc: Saravana Kannan <saravanak@xxxxxxxxxx>
Cc: Krzysztof Kozlowski <krzk@xxxxxxxxxx>
Cc: Sylwester Nawrocki <s.nawrocki@xxxxxxxxxxx>
Cc: Peter Griffin <peter.griffin@xxxxxxxxxx>
Cc: Alim Akhtar <alim.akhtar@xxxxxxxxxxx>
Cc: Linus Walleij <linusw@xxxxxxxxxx>
Cc: Anil Gurumurthy <anil.gurumurthy@xxxxxxxxxx>
Cc: Sudarsana Kalluru <sudarsana.kalluru@xxxxxxxxxx>
Cc: "Martin K. Petersen" <mkp@xxxxxxxxxx>
Cc: Trond Myklebust <trondmy@xxxxxxxxxx>
Cc: Anna Schumaker <anna@xxxxxxxxxx>
Cc: Mike Marshall <hubcap@xxxxxxxxxxxx>
Cc: Martin Brandenburg <martin@xxxxxxxxxxxx>
Cc: Kees Cook <kees@xxxxxxxxxx>
Cc: Jiri Pirko <jiri@xxxxxxxxxxx>
Cc: Simon Horman <horms@xxxxxxxxxx>
Cc: Chuck Lever <cel@xxxxxxxxxx>
Cc: Jeff Layton <jlayton@xxxxxxxxxx>
Cc: NeilBrown <neil@xxxxxxxxxx>
Cc: Olga Kornievskaia <okorniev@xxxxxxxxxx>
Cc: Dai Ngo <Dai.Ngo@xxxxxxxxxx>
Cc: Tom Talpey <tom@xxxxxxxxxx>
Cc: Jaroslav Kysela <perex@xxxxxxxx>
Cc: Takashi Iwai <tiwai@xxxxxxxx>
Cc: Bill Wendling <morbo@xxxxxxxxxx>
Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Cc: "Mike Rapoport (Microsoft)" <rppt@xxxxxxxxxx>
Cc: Kanglong Wang <wangkanglong@xxxxxxxxxxx>
Cc: Tiezhu Yang <yangtiezhu@xxxxxxxxxxx>
Cc: Qiang Ma <maqianga@xxxxxxxxxxxxx>
Cc: Randy Dunlap <rdunlap@xxxxxxxxxxxxx>
Cc: Pengpeng Hou <pengpeng@xxxxxxxxxxx>
Cc: Ard Biesheuvel <ardb@xxxxxxxxxx>
Cc: Breno Leitao <leitao@xxxxxxxxxx>
Cc: Thorsten Blum <blum@xxxxxxxxxx>
Cc: Harshit Mogalapalli <harshit.m.mogalapalli@xxxxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
Cc: Lyude Paul <lyude@xxxxxxxxxx>
Cc: Ashutosh Desai <ashutoshdesai993@xxxxxxxxx>
Cc: Imre Deak <imre.deak@xxxxxxxxx>
Cc: Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxxxxxxxx>
Cc: Johan Hovold <johan@xxxxxxxxxx>
Cc: Johannes Berg <johannes.berg@xxxxxxxxx>
Cc: Miri Korenblit <miriam.rachel.korenblit@xxxxxxxxx>
Cc: Alexander Stein <alexander.stein@xxxxxxxxxxxxxxx>
Cc: Cryolitia PukNgae <cryolitia@xxxxxxxxxxxxx>
Cc: Jiaming Zhang <r772577952@xxxxxxxxx>
Cc: Will Porter <mrwillporter@xxxxxxxxx>
Cc: Cen Zhang <zzzccc427@xxxxxxxxx>
Cc: "Cássio Gabriel" <cassiogabrielcontato@xxxxxxxxx>
Cc: Rong Zhang <i@xxxxxxxx>
Cc: Arun Raghavan <arunr@xxxxxxxxxxxxxxxxx>
Cc: linux-arm-kernel@xxxxxxxxxxxxxxxxxxx
Cc: linux-kernel@xxxxxxxxxxxxxxx
Cc: loongarch@xxxxxxxxxxxxxxx
Cc: linux-mips@xxxxxxxxxxxxxxx
Cc: linux-parisc@xxxxxxxxxxxxxxx
Cc: linux-edac@xxxxxxxxxxxxxxx
Cc: dri-devel@xxxxxxxxxxxxxxxxxxxxx
Cc: intel-xe@xxxxxxxxxxxxxxxxxxxxx
Cc: linux-input@xxxxxxxxxxxxxxx
Cc: linux-media@xxxxxxxxxxxxxxx
Cc: intel-wired-lan@xxxxxxxxxxxxxxxx
Cc: netdev@xxxxxxxxxxxxxxx
Cc: linux-wireless@xxxxxxxxxxxxxxx
Cc: brcm80211@xxxxxxxxxxxxxxx
Cc: brcm80211-dev-list.pdl@xxxxxxxxxxxx
Cc: devicetree@xxxxxxxxxxxxxxx
Cc: linux-samsung-soc@xxxxxxxxxxxxxxx
Cc: linux-gpio@xxxxxxxxxxxxxxx
Cc: linux-scsi@xxxxxxxxxxxxxxx
Cc: linux-nfs@xxxxxxxxxxxxxxx
Cc: devel@xxxxxxxxxxxxxxxxxx
Cc: linux-hardening@xxxxxxxxxxxxxxx
Cc: linux-sound@xxxxxxxxxxxxxxx
--
2.47.3