Re: [PATCH] selftests/mount: Explicitly define buffer size

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux