From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: B K Karthik <bkkarthik@pesu.pes.edu>
Cc: Johan Hovold <johan@kernel.org>, Alex Elder <elder@kernel.org>,
greybus-dev@lists.linaro.org, devel@driverdev.osuosl.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: greybus: audio_helper.c: Replace strlcpy() with strscpy()
Date: Wed, 27 Jan 2021 13:00:37 +0100 [thread overview]
Message-ID: <YBFV5eo5AYmLd4E0@kroah.com> (raw)
In-Reply-To: <20210109132731.tczawd5p74xnfz7p@pesu.pes.edu>
On Sat, Jan 09, 2021 at 06:57:31PM +0530, B K Karthik wrote:
> In gbaudio_remove_controls() , replace the usage of strlcpy() with
> strscpy() because strlcpy() only limits the *destination*
> size, and the source is always read fully.
>
> https://lore.kernel.org/r/CAHk-=wgfRnXz0W3D37d01q3JFkr_i_uTL=V6A6G1oUZcprmknw@mail.gmail.com/
> was quoted by checkpatch while showing this warning.
>
> Signed-off-by: B K Karthik <bkkarthik@pesu.pes.edu>
> ---
> drivers/staging/greybus/audio_helper.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/greybus/audio_helper.c b/drivers/staging/greybus/audio_helper.c
> index 3011b8abce38..1ed4772d2771 100644
> --- a/drivers/staging/greybus/audio_helper.c
> +++ b/drivers/staging/greybus/audio_helper.c
> @@ -166,7 +166,7 @@ static int gbaudio_remove_controls(struct snd_card *card, struct device *dev,
> snprintf(id.name, sizeof(id.name), "%s %s", prefix,
> control->name);
> else
> - strlcpy(id.name, control->name, sizeof(id.name));
> + strscpy(id.name, control->name, sizeof(id.name));
Is this something that matters here? Isn't the string coming from the
kernel (i.e. a trusted source), or if not, where is it coming from?
thanks,
greg k-h
prev parent reply other threads:[~2021-01-27 12:09 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-09 13:27 [PATCH] staging: greybus: audio_helper.c: Replace strlcpy() with strscpy() B K Karthik
2021-01-27 12:00 ` Greg Kroah-Hartman [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=YBFV5eo5AYmLd4E0@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=bkkarthik@pesu.pes.edu \
--cc=devel@driverdev.osuosl.org \
--cc=elder@kernel.org \
--cc=greybus-dev@lists.linaro.org \
--cc=johan@kernel.org \
--cc=linux-kernel@vger.kernel.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