From: Ian Bridges <icb@fastmail.org>
To: Matthias Schwarzott <zzam@gentoo.org>,
Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-hardening@vger.kernel.org
Subject: [PATCH] media: si2165: Replace strlcat() with snprintf()
Date: Thu, 2 Jul 2026 12:26:38 -0500 [thread overview]
Message-ID: <akafTmRDnPK4L3A1@dev> (raw)
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
reply other threads:[~2026-07-02 17:27 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=akafTmRDnPK4L3A1@dev \
--to=icb@fastmail.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=zzam@gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox