From: Greg KH <gregkh@linuxfoundation.org>
To: Pranav Tyagi <pranav.tyagi03@gmail.com>
Cc: mark@fasheh.com, jlbec@evilplan.org, joseph.qi@linux.alibaba.com,
skhan@linuxfoundation.org, ocfs2-devel@lists.linux.dev,
linux-kernel@vger.kernel.org,
linux-kernel-mentees@lists.linux.dev
Subject: Re: [PATCH] fs/ocfs2: use scnprintf() in show functions
Date: Mon, 16 Jun 2025 16:21:40 +0200 [thread overview]
Message-ID: <2025061626-amusable-grove-e6e4@gregkh> (raw)
In-Reply-To: <20250616105028.371633-1-pranav.tyagi03@gmail.com>
On Mon, Jun 16, 2025 at 04:20:28PM +0530, Pranav Tyagi wrote:
> Replace all snprintf() instances with scnprintf(). snprintf() returns
> the number of bytes that would have been written had there been enough
> space. For sysfs attributes, snprintf() should not be used for the
> show() method. Instead use scnprintf() which returns the number of bytes
> actually written.
>
> Signed-off-by: Pranav Tyagi <pranav.tyagi03@gmail.com>
> ---
> fs/ocfs2/cluster/masklog.c | 2 +-
> fs/ocfs2/cluster/sys.c | 2 +-
> fs/ocfs2/stackglue.c | 14 +++++++-------
> 3 files changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/fs/ocfs2/cluster/masklog.c b/fs/ocfs2/cluster/masklog.c
> index 563881ddbf00..0bc21dc71d29 100644
> --- a/fs/ocfs2/cluster/masklog.c
> +++ b/fs/ocfs2/cluster/masklog.c
> @@ -28,7 +28,7 @@ static ssize_t mlog_mask_show(u64 mask, char *buf)
> else
> state = "off";
>
> - return snprintf(buf, PAGE_SIZE, "%s\n", state);
> + return scnprintf(buf, PAGE_SIZE, "%s\n", state);
sysfs_emit() or no change at all please.
prev parent reply other threads:[~2025-06-16 14:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-16 10:50 [PATCH] fs/ocfs2: use scnprintf() in show functions Pranav Tyagi
2025-06-16 14:21 ` Greg KH [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=2025061626-amusable-grove-e6e4@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=jlbec@evilplan.org \
--cc=joseph.qi@linux.alibaba.com \
--cc=linux-kernel-mentees@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=mark@fasheh.com \
--cc=ocfs2-devel@lists.linux.dev \
--cc=pranav.tyagi03@gmail.com \
--cc=skhan@linuxfoundation.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;
as well as URLs for NNTP newsgroup(s).