* [PATCH] media: si2165: Replace strlcat() with snprintf()
@ 2026-07-02 17:26 Ian Bridges
0 siblings, 0 replies; only message in thread
From: Ian Bridges @ 2026-07-02 17:26 UTC (permalink / raw)
To: Matthias Schwarzott, Mauro Carvalho Chehab
Cc: linux-media, linux-kernel, linux-hardening
In preparation for removing the strlcat() API[1], replace its uses in
si2165_probe(). The chip name and the supported delivery systems are
already known when the frontend name is built, so the whole name can be
produced by a single snprintf(), seeded from the same si2165_ops
template default that the strlcat() calls appended to.
Link: https://github.com/KSPP/linux/issues/370 [1]
Signed-off-by: Ian Bridges <icb@fastmail.org>
---
I don't have si2165 hardware, so I tested the patch with:
- x86_64 build at W=1 with no warnings. Applies cleanly on the media
tree next branch.
- Module load/unload in an x86_64 QEMU guest.
- A userspace comparison of the old and new name construction for both
chip types; outputs are identical.
drivers/media/dvb-frontends/si2165.c | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)
diff --git a/drivers/media/dvb-frontends/si2165.c b/drivers/media/dvb-frontends/si2165.c
index f1241b63aa5c..ebb4083b99a8 100644
--- a/drivers/media/dvb-frontends/si2165.c
+++ b/drivers/media/dvb-frontends/si2165.c
@@ -1243,20 +1243,16 @@ static int si2165_probe(struct i2c_client *client)
chip_name, rev_char, state->chip_type,
state->chip_revcode);
- strlcat(state->fe.ops.info.name, chip_name,
- sizeof(state->fe.ops.info.name));
+ snprintf(state->fe.ops.info.name, sizeof(state->fe.ops.info.name),
+ "%s%s%s%s", si2165_ops.info.name, chip_name,
+ state->has_dvbt ? " DVB-T" : "",
+ state->has_dvbc ? " DVB-C" : "");
n = 0;
- if (state->has_dvbt) {
+ if (state->has_dvbt)
state->fe.ops.delsys[n++] = SYS_DVBT;
- strlcat(state->fe.ops.info.name, " DVB-T",
- sizeof(state->fe.ops.info.name));
- }
- if (state->has_dvbc) {
+ if (state->has_dvbc)
state->fe.ops.delsys[n++] = SYS_DVBC_ANNEX_A;
- strlcat(state->fe.ops.info.name, " DVB-C",
- sizeof(state->fe.ops.info.name));
- }
/* return fe pointer */
*pdata->fe = &state->fe;
--
2.47.3
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-07-02 17:27 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-02 17:26 [PATCH] media: si2165: Replace strlcat() with snprintf() Ian Bridges
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.