All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Pranav Tyagi <pranav.tyagi03@gmail.com>
Cc: code@tyhicks.com, brauner@kernel.org, sandeen@redhat.com,
	colin.i.king@gmail.com, skhan@linuxfoundation.org,
	ecryptfs@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-kernel-mentees@lists.linux.dev
Subject: Re: [PATCH] fs/ecryptfs: use scnprintf() in version show
Date: Mon, 16 Jun 2025 16:21:56 +0200	[thread overview]
Message-ID: <2025061642-unaltered-antler-e6fa@gregkh> (raw)
In-Reply-To: <20250616104120.370832-1-pranav.tyagi03@gmail.com>

On Mon, Jun 16, 2025 at 04:11:20PM +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/ecryptfs/main.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c
> index 8dd1d7189c3b..2a97c2b1fc69 100644
> --- a/fs/ecryptfs/main.c
> +++ b/fs/ecryptfs/main.c
> @@ -764,7 +764,7 @@ static struct kobject *ecryptfs_kobj;
>  static ssize_t version_show(struct kobject *kobj,
>  			    struct kobj_attribute *attr, char *buff)
>  {
> -	return snprintf(buff, PAGE_SIZE, "%d\n", ECRYPTFS_VERSIONING_MASK);
> +	return scnprintf(buff, PAGE_SIZE, "%d\n", ECRYPTFS_VERSIONING_MASK);

sysfs_emit() or no change at all please.

      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:41 [PATCH] fs/ecryptfs: use scnprintf() in version show 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=2025061642-unaltered-antler-e6fa@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=brauner@kernel.org \
    --cc=code@tyhicks.com \
    --cc=colin.i.king@gmail.com \
    --cc=ecryptfs@vger.kernel.org \
    --cc=linux-kernel-mentees@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pranav.tyagi03@gmail.com \
    --cc=sandeen@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.