lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2025022257-easter-shower-61df@gregkh>
Date: Sat, 22 Feb 2025 09:36:29 +0100
From: Greg KH <gregkh@...uxfoundation.org>
To: ritvikfoss@...il.com
Cc: shuah@...nel.org, linux-kselftest@...r.kernel.org,
	linux-kernel@...r.kernel.org, skhan@...uxfoundation.org,
	linux-kernel-mentees@...ts.linuxfoundation.org
Subject: Re: [PATCH] selftests/mount: Explicitly define buffer size

On Sat, Feb 22, 2025 at 01:47:11PM +0530, ritvikfoss@...il.com wrote:
> From: Ritvik Gupta <ritvikfoss@...il.com>
> 
> Define macro ('MAX_BUF_SIZE') for buffer size
> instead of hardcoded value '4096', to improve
> readability.
> 
> Signed-off-by: Ritvik Gupta <ritvikfoss@...il.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ