From: Alejandro Colomar <alx+linux-hardening@kernel.org>
To: Mariia Nikitash <nikitash.mariiaw@gmail.com>
Cc: hverkuil@kernel.org, mchehab@kernel.org,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-hardening@vger.kernel.org, kees@kernel.org,
justinstitt@google.com, morbo@google.com
Subject: Re: [PATCH] media: radio: Replace strlcat() with seq_buf in TEA drivers
Date: Sat, 7 Nov 2026 08:39:13 +0100 [thread overview]
Message-ID: <au7VGW5qpYAbVLxc@debian> (raw)
In-Reply-To: <CAPDEY+Wa2+zxSVz8fewXDP78eA8-3ymAKurXuvB1Dhx7heLMiQ@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1482 bytes --]
Hi Mariia,
> Date: 2026-11-06 20:31:53-0800
> From: Mariia Nikitash <nikitash.mariiaw@gmail.com>
>
[...]
> > > @@ -255,10 +256,15 @@ static int vidioc_querycap(struct file *file, void *priv,
> > > struct v4l2_capability *v)
> > > {
> > > struct radio_tea5777 *tea = video_drvdata(file);
> > > + struct seq_buf s;
> > >
> > > 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));
> > > +
> > > + seq_buf_init(&s, (char *)v->card, sizeof(v->card));
> > > + seq_buf_puts(&s, (const char *)tea->card);
> > > + seq_buf_puts(&s, " TEA5777");
> > > + seq_buf_terminate(&s);
> > > +
> >
> > Why are the casts needed?
>
> Hi Alex,
>
> I added the casts to make conversions from u8/__u8 to
> character-pointer types expected by the seq_buf helpers explicit.
I was surprised that it wasn't needed before. In theory, strscpy()
should be expecting the same types, so if it wasn't needed before, it
shouldn't be needed now (and conversely, if it is needed now, it would
have been needed before).
>
> I'm also considering simplifying these two-part string constructions
> using scnprintf() instead. Would this approach be preferred?
I certainly prefer scnprintf() over seq_buf. :)
Have a lovely day!
Alex
--
<https://www.alejandro-colomar.es>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
prev parent reply other threads:[~2026-11-07 7:39 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-06 7:46 Mariia Nikitash
2026-11-06 10:39 ` Alejandro Colomar
2026-11-07 4:31 ` Mariia Nikitash
2026-11-07 7:39 ` Alejandro Colomar [this message]
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=au7VGW5qpYAbVLxc@debian \
--to=alx+linux-hardening@kernel.org \
--cc=hverkuil@kernel.org \
--cc=justinstitt@google.com \
--cc=kees@kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=morbo@google.com \
--cc=nikitash.mariiaw@gmail.com \
/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
all inboxes | Powered by JetHome®