[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <2025061626-amusable-grove-e6e4@gregkh>
Date: Mon, 16 Jun 2025 16:21:40 +0200
From: Greg KH <gregkh@...uxfoundation.org>
To: Pranav Tyagi <pranav.tyagi03@...il.com>
Cc: mark@...heh.com, jlbec@...lplan.org, joseph.qi@...ux.alibaba.com,
skhan@...uxfoundation.org, ocfs2-devel@...ts.linux.dev,
linux-kernel@...r.kernel.org, linux-kernel-mentees@...ts.linux.dev
Subject: Re: [PATCH] fs/ocfs2: use scnprintf() in show functions
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@...il.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.
Powered by blists - more mailing lists