From: Greg KH <gregkh@linuxfoundation.org>
To: Dharanitharan R <dharanitharan725@gmail.com>
Cc: johan@kernel.org, elder@kernel.org, greybus-dev@lists.linaro.org,
linux-staging@lists.linux.dev
Subject: Re: [PATCH] staging: greybus: replace strncpy() with strlcpy() in firmware test tool
Date: Mon, 17 Nov 2025 07:33:21 -0500 [thread overview]
Message-ID: <2025111706-glacial-lantern-337e@gregkh> (raw)
In-Reply-To: <20251117065003.7453-1-dharanitharan725@gmail.com>
On Mon, Nov 17, 2025 at 06:50:03AM +0000, Dharanitharan R wrote:
> The sample userspace firmware-management tool uses strncpy() to copy
> firmware tags. strncpy() does not guarantee null-termination and can
> leave buffers unterminated. For userspace code, strlcpy() is the
> recommended safe alternative.
>
> Replace all strncpy() calls with strlcpy().
>
> Signed-off-by: Dharanitharan <dharanitharan725@gmail.com>
> ---
> .../greybus/Documentation/firmware/firmware.c | 14 ++++++++------
> 1 file changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/staging/greybus/Documentation/firmware/firmware.c b/drivers/staging/greybus/Documentation/firmware/firmware.c
> index 3b35ef6d4adb..224eb8f4e39c 100644
> --- a/drivers/staging/greybus/Documentation/firmware/firmware.c
> +++ b/drivers/staging/greybus/Documentation/firmware/firmware.c
> @@ -63,8 +63,9 @@ static int update_intf_firmware(int fd)
> intf_load.major = 0;
> intf_load.minor = 0;
>
> - strncpy((char *)&intf_load.firmware_tag, firmware_tag,
> - GB_FIRMWARE_U_TAG_MAX_SIZE);
> + strlcpy(intf_load.firmware_tag, firmware_tag,
> + GB_FIRMWARE_U_TAG_MAX_SIZE);
> +
What happened to the indentation?
:(
next prev parent reply other threads:[~2025-11-17 12:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-17 6:50 [PATCH] staging: greybus: replace strncpy() with strlcpy() in firmware test tool Dharanitharan R
2025-11-17 12:33 ` Greg KH [this message]
2025-11-18 7:36 ` Dan Carpenter
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=2025111706-glacial-lantern-337e@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=dharanitharan725@gmail.com \
--cc=elder@kernel.org \
--cc=greybus-dev@lists.linaro.org \
--cc=johan@kernel.org \
--cc=linux-staging@lists.linux.dev \
/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;
as well as URLs for NNTP newsgroup(s).