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] [day] [month] [year] [list]
Message-ID: <20230104102359.4bfndqhuddmkqymq@fedora>
Date:   Wed, 4 Jan 2023 11:23:59 +0100
From:   Lukas Czerner <lczerner@...hat.com>
To:     Eric Biggers <ebiggers@...nel.org>
Cc:     linux-ext4@...r.kernel.org
Subject: Re: [e2fsprogs PATCH] libsupport: clean up definition of flags_array

On Wed, Jan 04, 2023 at 01:03:23AM -0800, Eric Biggers wrote:
> From: Eric Biggers <ebiggers@...gle.com>
> 
> Add braces to address the following compiler warning with gcc -Wall:
> 
> print_fs_flags.c:24:42: warning: missing braces around initializer [-Wmissing-braces]
>    24 | static struct flags_name flags_array[] = {
>       |                                          ^
> 
> Also add 'const', and add an explicit NULL in the last entry.

Looks good, thanks.

Reviewed-by: Lukas Czerner <lczerner@...hat.com>

> 
> Signed-off-by: Eric Biggers <ebiggers@...gle.com>
> ---
>  lib/support/print_fs_flags.c | 60 ++++++++++++++++++------------------
>  1 file changed, 30 insertions(+), 30 deletions(-)
> 
> diff --git a/lib/support/print_fs_flags.c b/lib/support/print_fs_flags.c
> index e54acc04..f47cd665 100644
> --- a/lib/support/print_fs_flags.c
> +++ b/lib/support/print_fs_flags.c
> @@ -21,40 +21,40 @@ struct flags_name {
>  	const char	*name;
>  };
>  
> -static struct flags_name flags_array[] = {
> -	EXT2_FLAG_RW, "EXT2_FLAG_RW",
> -	EXT2_FLAG_CHANGED, "EXT2_FLAG_CHANGED",
> -	EXT2_FLAG_DIRTY, "EXT2_FLAG_DIRTY",
> -	EXT2_FLAG_VALID, "EXT2_FLAG_VALID",
> -	EXT2_FLAG_IB_DIRTY, "EXT2_FLAG_IB_DIRTY",
> -	EXT2_FLAG_BB_DIRTY, "EXT2_FLAG_BB_DIRTY",
> -	EXT2_FLAG_SWAP_BYTES, "EXT2_FLAG_SWAP_BYTES",
> -	EXT2_FLAG_SWAP_BYTES_READ, "EXT2_FLAG_SWAP_BYTES_READ",
> -	EXT2_FLAG_SWAP_BYTES_WRITE, "EXT2_FLAG_SWAP_BYTES_WRITE",
> -	EXT2_FLAG_MASTER_SB_ONLY, "EXT2_FLAG_MASTER_SB_ONLY",
> -	EXT2_FLAG_FORCE, "EXT2_FLAG_FORCE",
> -	EXT2_FLAG_SUPER_ONLY, "EXT2_FLAG_SUPER_ONLY",
> -	EXT2_FLAG_JOURNAL_DEV_OK, "EXT2_FLAG_JOURNAL_DEV_OK",
> -	EXT2_FLAG_IMAGE_FILE, "EXT2_FLAG_IMAGE_FILE",
> -	EXT2_FLAG_EXCLUSIVE, "EXT2_FLAG_EXCLUSIVE",
> -	EXT2_FLAG_SOFTSUPP_FEATURES, "EXT2_FLAG_SOFTSUPP_FEATURES",
> -	EXT2_FLAG_NOFREE_ON_ERROR, "EXT2_FLAG_NOFREE_ON_ERROR",
> -	EXT2_FLAG_64BITS, "EXT2_FLAG_64BITS",
> -	EXT2_FLAG_PRINT_PROGRESS, "EXT2_FLAG_PRINT_PROGRESS",
> -	EXT2_FLAG_DIRECT_IO, "EXT2_FLAG_DIRECT_IO",
> -	EXT2_FLAG_SKIP_MMP, "EXT2_FLAG_SKIP_MMP",
> -	EXT2_FLAG_IGNORE_CSUM_ERRORS, "EXT2_FLAG_IGNORE_CSUM_ERRORS",
> -	EXT2_FLAG_SHARE_DUP, "EXT2_FLAG_SHARE_DUP",
> -	EXT2_FLAG_IGNORE_SB_ERRORS, "EXT2_FLAG_IGNORE_SB_ERRORS",
> -	EXT2_FLAG_BBITMAP_TAIL_PROBLEM, "EXT2_FLAG_BBITMAP_TAIL_PROBLEM",
> -	EXT2_FLAG_IBITMAP_TAIL_PROBLEM, "EXT2_FLAG_IBITMAP_TAIL_PROBLEM",
> -	EXT2_FLAG_THREADS, "EXT2_FLAG_THREADS",
> -	0
> +static const struct flags_name flags_array[] = {
> +	{ EXT2_FLAG_RW, "EXT2_FLAG_RW" },
> +	{ EXT2_FLAG_CHANGED, "EXT2_FLAG_CHANGED" },
> +	{ EXT2_FLAG_DIRTY, "EXT2_FLAG_DIRTY" },
> +	{ EXT2_FLAG_VALID, "EXT2_FLAG_VALID" },
> +	{ EXT2_FLAG_IB_DIRTY, "EXT2_FLAG_IB_DIRTY" },
> +	{ EXT2_FLAG_BB_DIRTY, "EXT2_FLAG_BB_DIRTY" },
> +	{ EXT2_FLAG_SWAP_BYTES, "EXT2_FLAG_SWAP_BYTES" },
> +	{ EXT2_FLAG_SWAP_BYTES_READ, "EXT2_FLAG_SWAP_BYTES_READ" },
> +	{ EXT2_FLAG_SWAP_BYTES_WRITE, "EXT2_FLAG_SWAP_BYTES_WRITE" },
> +	{ EXT2_FLAG_MASTER_SB_ONLY, "EXT2_FLAG_MASTER_SB_ONLY" },
> +	{ EXT2_FLAG_FORCE, "EXT2_FLAG_FORCE" },
> +	{ EXT2_FLAG_SUPER_ONLY, "EXT2_FLAG_SUPER_ONLY" },
> +	{ EXT2_FLAG_JOURNAL_DEV_OK, "EXT2_FLAG_JOURNAL_DEV_OK" },
> +	{ EXT2_FLAG_IMAGE_FILE, "EXT2_FLAG_IMAGE_FILE" },
> +	{ EXT2_FLAG_EXCLUSIVE, "EXT2_FLAG_EXCLUSIVE" },
> +	{ EXT2_FLAG_SOFTSUPP_FEATURES, "EXT2_FLAG_SOFTSUPP_FEATURES" },
> +	{ EXT2_FLAG_NOFREE_ON_ERROR, "EXT2_FLAG_NOFREE_ON_ERROR" },
> +	{ EXT2_FLAG_64BITS, "EXT2_FLAG_64BITS" },
> +	{ EXT2_FLAG_PRINT_PROGRESS, "EXT2_FLAG_PRINT_PROGRESS" },
> +	{ EXT2_FLAG_DIRECT_IO, "EXT2_FLAG_DIRECT_IO" },
> +	{ EXT2_FLAG_SKIP_MMP, "EXT2_FLAG_SKIP_MMP" },
> +	{ EXT2_FLAG_IGNORE_CSUM_ERRORS, "EXT2_FLAG_IGNORE_CSUM_ERRORS" },
> +	{ EXT2_FLAG_SHARE_DUP, "EXT2_FLAG_SHARE_DUP" },
> +	{ EXT2_FLAG_IGNORE_SB_ERRORS, "EXT2_FLAG_IGNORE_SB_ERRORS" },
> +	{ EXT2_FLAG_BBITMAP_TAIL_PROBLEM, "EXT2_FLAG_BBITMAP_TAIL_PROBLEM" },
> +	{ EXT2_FLAG_IBITMAP_TAIL_PROBLEM, "EXT2_FLAG_IBITMAP_TAIL_PROBLEM" },
> +	{ EXT2_FLAG_THREADS, "EXT2_FLAG_THREADS" },
> +	{ 0, NULL },
>  };
>  
>  void print_fs_flags(FILE * f, unsigned long flags)
>  {
> -	struct flags_name *fp;
> +	const struct flags_name *fp;
>  	int	first = 1, pos = 16;
>  
>  	for (fp = flags_array; fp->flag != 0; fp++) {
> -- 
> 2.39.0
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ