[PATCH v2] media: radio: Replace strlcat() with scnprintf() in TEA drivers
From: Mariia Nikitash
Date: Fri Dec 04 2026 - 21:04:44 EST
In preparation for removing the deprecated strlcat() API[1],
replace the strscpy() and strlcat() calls used to construct
V4L2 card names in the TEA5777 and TEA575x radio drivers.
Construct each card name with a single scnprintf() call, preserving
the original output and truncation behavior.
Link: https://github.com/KSPP/linux/issues/370 [1]
Signed-off-by: Mariia Nikitash <nikitash.mariiaw@xxxxxxxxx>
---
Changes in v2:
- Use scnprintf() instead of seq_buf based on reviewer feedback.
---
drivers/media/radio/radio-tea5777.c | 3 +--
drivers/media/radio/tea575x.c | 4 ++--
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/media/radio/radio-tea5777.c b/drivers/media/radio/radio-tea5777.c
index fb9de7bbcd19..63e7369bedad 100644
--- a/drivers/media/radio/radio-tea5777.c
+++ b/drivers/media/radio/radio-tea5777.c
@@ -257,8 +257,7 @@ static int vidioc_querycap(struct file *file, void *priv,
struct radio_tea5777 *tea = video_drvdata(file);
strscpy(v->driver, tea->v4l2_dev->name, sizeof(v->driver));
- strscpy(v->card, tea->card, sizeof(v->card));
- strlcat(v->card, " TEA5777", sizeof(v->card));
+ scnprintf(v->card, sizeof(v->card), "%s TEA5777", tea->card);
strscpy(v->bus_info, tea->bus_info, sizeof(v->bus_info));
return 0;
}
diff --git a/drivers/media/radio/tea575x.c b/drivers/media/radio/tea575x.c
index c37315226c42..9a91ccedcf30 100644
--- a/drivers/media/radio/tea575x.c
+++ b/drivers/media/radio/tea575x.c
@@ -223,8 +223,8 @@ static int vidioc_querycap(struct file *file, void *priv,
struct snd_tea575x *tea = video_drvdata(file);
strscpy(v->driver, tea->v4l2_dev->name, sizeof(v->driver));
- strscpy(v->card, tea->card, sizeof(v->card));
- strlcat(v->card, tea->tea5759 ? " TEA5759" : " TEA5757", sizeof(v->card));
+ scnprintf(v->card, sizeof(v->card), "%s%s", tea->card,
+ tea->tea5759 ? " TEA5759" : " TEA5757");
strscpy(v->bus_info, tea->bus_info, sizeof(v->bus_info));
return 0;
}
---
base-commit: 05441d697f7f9a927264f4058cbbc6a03dfcac9d
change-id: 20261203-strlcat-removal-tea-radio-8a531e00f706