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 PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Wed, 31 Aug 2022 13:41:55 +0200 From: Jan Kara <jack@...e.cz> To: Jason Yan <yanaijie@...wei.com> Cc: tytso@....edu, adilger.kernel@...ger.ca, jack@...e.cz, ritesh.list@...il.com, lczerner@...hat.com, linux-ext4@...r.kernel.org Subject: Re: [PATCH 02/13] ext4: remove cantfind_ext4 error handler On Tue 30-08-22 20:04:00, Jason Yan wrote: > The 'cantfind_ext4' error handler is just a error msg print and then > goto failed_mount. This two level goto makes the code complex and not > easy to read. The only benefit is that is saves a little bit code. > However some branches can merge and some branches dot not even need it. > So do some refactor and remove it. > > Signed-off-by: Jason Yan <yanaijie@...wei.com> Yeah, probably makes sense. Just small style nits below. Feel free to add: Reviewed-by: Jan Kara <jack@...e.cz> > @@ -4798,8 +4800,11 @@ static int __ext4_fill_super(struct fs_context *fc, struct super_block *sb) > sbi->s_inodes_per_group = le32_to_cpu(es->s_inodes_per_group); > > sbi->s_inodes_per_block = blocksize / EXT4_INODE_SIZE(sb); > - if (sbi->s_inodes_per_block == 0) > - goto cantfind_ext4; > + if (sbi->s_inodes_per_block == 0 || (EXT4_BLOCKS_PER_GROUP(sb) == 0)) { I'd write this as: if (sbi->s_inodes_per_block == 0 || sbi->s_blocks_per_group == 0) { to avoid superfluous braces and make the code a bit more natural. Honza > + if (!silent) > + ext4_msg(sb, KERN_ERR, "VFS: Can't find ext4 filesystem"); > + goto failed_mount; > + } > if (sbi->s_inodes_per_group < sbi->s_inodes_per_block || > sbi->s_inodes_per_group > blocksize * 8) { > ext4_msg(sb, KERN_ERR, "invalid inodes per group: %lu\n", > @@ -4896,9 +4901,6 @@ static int __ext4_fill_super(struct fs_context *fc, struct super_block *sb) > goto failed_mount; > } > > - if (EXT4_BLOCKS_PER_GROUP(sb) == 0) > - goto cantfind_ext4; > - > /* check blocks count against device size */ > blocks_count = sb_bdev_nr_blocks(sb); > if (blocks_count && ext4_blocks_count(es) > blocks_count) { > @@ -5408,11 +5410,6 @@ static int __ext4_fill_super(struct fs_context *fc, struct super_block *sb) > > return 0; > > -cantfind_ext4: > - if (!silent) > - ext4_msg(sb, KERN_ERR, "VFS: Can't find ext4 filesystem"); > - goto failed_mount; > - > failed_mount9: > ext4_release_orphan_info(sb); > failed_mount8: > -- > 2.31.1 > -- Jan Kara <jack@...e.com> SUSE Labs, CR
Powered by blists - more mailing lists