From: Dan Carpenter <error27@gmail.com>
To: Kurmapu Sai Devansh Prasad <btech10487.26@bitmesra.ac.in>
Cc: johan@kernel.org, elder@kernel.org, gregkh@linuxfoundation.org,
greybus-dev@lists.linaro.org, linux-staging@lists.linux.dev,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: greybus: fix string termination in firmware sample
Date: Mon, 2 Nov 2026 17:43:55 +0300 [thread overview]
Message-ID: <auihq9nm86d6D3MW@stanley.mountain> (raw)
In-Reply-To: <CAPwSj7XvbTR3qtSev-xEtZeewwvSWFXPhK5F12VGzSiQoNudNg@mail.gmail.com>
On Mon, Nov 02, 2026 at 07:44:09PM +0530, Kurmapu Sai Devansh Prasad wrote:
> >From 9114eb9d60f2c4a52f05e3a33b0d6b8ca4856cac Mon Sep 17 00:00:00 2001
> From: Kurmapu Sai Devansh Prasad <btech10487.26@bitmesra.ac.in>
> Date: Mon, 2 Nov 2026 19:11:09 +0530
> Subject: [PATCH] staging: greybus: fix string termination in firmware sample
>
> The firmware_tag string copied via strncpy() is not guaranteed to be
> NUL-terminated if the source string is exactly the size of the destination
> buffer. This can lead to a buffer over-read.
>
> Since alternatives like strscpy_pad cannot be used in user space
> sample code, we can make it safer by limiting the copy size to
> MAX_SIZE - 1 and explicitly assigning the last byte to be a NUL
> terminator. This ensures the string is always
> safely terminated before being passed to the ioctl.
In user space, using strncpy() is fine.
>
> Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings
>
> This is my very first patch to the Linux kernel! I've been learning the
> process and would deeply appreciate any feedback from the maintainers.
Put this sort of unrelated conversational stuff under the --- cut off
>
> Signed-off-by: Kurmapu Sai Devansh Prasad <btech10487.26@bitmesra.ac.in>
> ---
^^^
here. So that it doesn't get saved into the kernel git log.
The patch is pretty badly corrupted and doesn't apply. Read the first
two paragraph of Documentation/process/email-clients.rst
regards,
dan carpenter
next prev parent reply other threads:[~2026-11-02 14:44 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-02 14:14 Kurmapu Sai Devansh Prasad
2026-11-02 14:43 ` Dan Carpenter [this message]
2026-11-02 15:19 ` Kurmapu Sai Devansh Prasad
2026-11-02 15:46 ` Dan Carpenter
2026-11-02 16:24 ` Kurmapu Sai Devansh Prasad
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=auihq9nm86d6D3MW@stanley.mountain \
--to=error27@gmail.com \
--cc=btech10487.26@bitmesra.ac.in \
--cc=elder@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=greybus-dev@lists.linaro.org \
--cc=johan@kernel.org \
--cc=linux-kernel@vger.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
all inboxes | Powered by JetHome®