From: Greg KH <gregkh@linuxfoundation.org>
To: ritvikfoss@gmail.com
Cc: shuah@kernel.org, linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org, skhan@linuxfoundation.org,
linux-kernel-mentees@lists.linuxfoundation.org
Subject: Re: [PATCH] selftests/mount: Explicitly define buffer size
Date: Sat, 22 Feb 2025 09:36:29 +0100 [thread overview]
Message-ID: <2025022257-easter-shower-61df@gregkh> (raw)
In-Reply-To: <20250222081711.48208-1-ritvikfoss@gmail.com>
On Sat, Feb 22, 2025 at 01:47:11PM +0530, ritvikfoss@gmail.com wrote:
> From: Ritvik Gupta <ritvikfoss@gmail.com>
>
> Define macro ('MAX_BUF_SIZE') for buffer size
> instead of hardcoded value '4096', to improve
> readability.
>
> Signed-off-by: Ritvik Gupta <ritvikfoss@gmail.com>
> ---
> tools/testing/selftests/mount/unprivileged-remount-test.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/mount/unprivileged-remount-test.c b/tools/testing/selftests/mount/unprivileged-remount-test.c
> index d2917054fe3a..67a550b7c69b 100644
> --- a/tools/testing/selftests/mount/unprivileged-remount-test.c
> +++ b/tools/testing/selftests/mount/unprivileged-remount-test.c
> @@ -45,6 +45,8 @@
> # define MS_STRICTATIME (1 << 24)
> #endif
>
> +#define MAX_BUF_SIZE 4096
> +
> static void die(char *fmt, ...)
> {
> va_list ap;
> @@ -56,7 +58,7 @@ static void die(char *fmt, ...)
>
> static void vmaybe_write_file(bool enoent_ok, char *filename, char *fmt, va_list ap)
> {
> - char buf[4096];
> + char buf[MAX_BUF_SIZE];
As this is only used once, why is a #define really needed at all? Only
do that if it makes sense (i.e. is checked in different places.)
thanks,
greg k-h
next prev parent reply other threads:[~2025-02-22 8:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-22 8:17 [PATCH] selftests/mount: Explicitly define buffer size ritvikfoss
2025-02-22 8:36 ` Greg KH [this message]
2025-02-22 9:30 ` Ritvik Gupta
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=2025022257-easter-shower-61df@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=linux-kernel-mentees@lists.linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=ritvikfoss@gmail.com \
--cc=shuah@kernel.org \
--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.