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]
Date:   Thu, 3 Aug 2023 16:19:56 +0200
From:   Jan Kara <jack@...e.cz>
To:     Zhang Yi <yi.zhang@...weicloud.com>
Cc:     linux-ext4@...r.kernel.org, tytso@....edu,
        adilger.kernel@...ger.ca, jack@...e.cz, yi.zhang@...wei.com,
        chengzhihao1@...wei.com, yukuai3@...wei.com
Subject: Re: [PATCH 05/12] jbd2: open code jbd2_verify_csum_type() helper

On Tue 04-07-23 21:42:26, Zhang Yi wrote:
> From: Zhang Yi <yi.zhang@...wei.com>
> 
> jbd2_verify_csum_type() helper check checksum type in the superblock for
> v2 or v3 checksum feature, it always return true if these features are
> not enabled, and it has only one user, so open code it is more clear.
> 
> Signed-off-by: Zhang Yi <yi.zhang@...wei.com>

Looks good. Feel free to add:

Reviewed-by: Jan Kara <jack@...e.cz>

								Honza

> ---
>  fs/jbd2/journal.c | 18 +++++-------------
>  1 file changed, 5 insertions(+), 13 deletions(-)
> 
> diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
> index d84f26b08315..46ab47b4439e 100644
> --- a/fs/jbd2/journal.c
> +++ b/fs/jbd2/journal.c
> @@ -115,14 +115,6 @@ void __jbd2_debug(int level, const char *file, const char *func,
>  #endif
>  
>  /* Checksumming functions */
> -static int jbd2_verify_csum_type(journal_t *j, journal_superblock_t *sb)
> -{
> -	if (!jbd2_journal_has_csum_v2or3_feature(j))
> -		return 1;
> -
> -	return sb->s_checksum_type == JBD2_CRC32C_CHKSUM;
> -}
> -
>  static __be32 jbd2_superblock_csum(journal_t *j, journal_superblock_t *sb)
>  {
>  	__u32 csum;
> @@ -1429,13 +1421,13 @@ static int journal_get_superblock(journal_t *journal)
>  		goto out;
>  	}
>  
> -	if (!jbd2_verify_csum_type(journal, sb)) {
> -		printk(KERN_ERR "JBD2: Unknown checksum type\n");
> -		goto out;
> -	}
> -
>  	/* Load the checksum driver */
>  	if (jbd2_journal_has_csum_v2or3_feature(journal)) {
> +		if (sb->s_checksum_type != JBD2_CRC32C_CHKSUM) {
> +			printk(KERN_ERR "JBD2: Unknown checksum type\n");
> +			goto out;
> +		}
> +
>  		journal->j_chksum_driver = crypto_alloc_shash("crc32c", 0, 0);
>  		if (IS_ERR(journal->j_chksum_driver)) {
>  			printk(KERN_ERR "JBD2: Cannot load crc32c driver.\n");
> -- 
> 2.39.2
> 
-- 
Jan Kara <jack@...e.com>
SUSE Labs, CR

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ