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: <20131216050147.GJ28536@thunk.org>
Date:	Mon, 16 Dec 2013 00:01:47 -0500
From:	Theodore Ts'o <tytso@....edu>
To:	"Darrick J. Wong" <darrick.wong@...cle.com>
Cc:	linux-ext4@...r.kernel.org
Subject: Re: [PATCH 47/74] resize2fs: during shrink, don't free in-use bg
 data clusters

On Tue, Dec 10, 2013 at 05:23:33PM -0800, Darrick J. Wong wrote:
> When freeing a group's metadata blocks, be careful not to free
> clusters belonging to other groups!
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@...cle.com>
> ---
>  resize/resize2fs.c |   78 +++++++++++++++++++++++++++++++++-------------------
>  1 file changed, 49 insertions(+), 29 deletions(-)
> 
> 
> diff --git a/resize/resize2fs.c b/resize/resize2fs.c
> index ff5e6a2..49fe986 100644
> --- a/resize/resize2fs.c
> +++ b/resize/resize2fs.c
> @@ -270,40 +270,60 @@ static void fix_uninit_block_bitmaps(ext2_filsys fs)
>   * release them in the new filesystem data structure, and mark them as
>   * reserved so the old inode table blocks don't get overwritten.
>   */
> -static void free_gdp_blocks(ext2_filsys fs,
> -			    ext2fs_block_bitmap reserve_blocks,
> -			    ext2_filsys old_fs,
> -			    dgrp_t group)
> +static errcode_t free_gdp_blocks(ext2_filsys fs,
> +				 ext2fs_block_bitmap reserve_blocks,
> +				 ext2_filsys old_fs,
> +				 dgrp_t group, dgrp_t count)

This function is only used in one place, and "count" is calculated
using values from fs and old_fs.

	old_fs->group_desc_count - fs->group_desc_count

Wouldn't it be clearer to do this calculation in free_gdp_blocks, i.e:

	dgrp_t count = old_fs->group_desc_count - fs->group_desc_count;

This makes it clearer what's going on, instead of using a generic
parameter name such as "count" which isn't as clear...

	       	       	       	     - Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists