Re: [PATCH 2/3] mke2fs: reduce the range of cluster-size

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

 



On 2013-01-13, at 2:08 AM, Zheng Liu wrote:
> Here we reduce the range of cluster-size and check s_blocks_per_group=0 to avoid 'division by zero' error.
> 
> Signed-off-by: Zheng Liu <wenqing.lz@xxxxxxxxxx>
> diff --git a/misc/mke2fs.c b/misc/mke2fs.c
> index bf4d7a2..f4140a1 100644
> --- a/misc/mke2fs.c
> +++ b/misc/mke2fs.c
> @@ -1384,8 +1384,8 @@ profile_error:
> 			break;
> 		case 'C':
> 			cluster_size = strtoul(optarg, &tmp, 0);
> -			if (cluster_size < EXT2_MIN_CLUSTER_SIZE ||
> -			    cluster_size > EXT2_MAX_CLUSTER_SIZE || *tmp) {
> +			if (cluster_size <= EXT2_MIN_CLUSTER_SIZE ||
> +			    cluster_size >= EXT2_MAX_CLUSTER_SIZE || *tmp) {
> 				com_err(program_name, 0,
> 					_("invalid cluster size - %s"),
> 					optarg);

Wouldn't it make more sense to change EXT2_MIN_CLUSTER_SIZE and EXT2_MAX_CLUSTER_SIZE?  Otherwise, those constants don't really
contain the min/max cluster size, and it is confusing to use them
in other code.

Cheers, Andreas





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


[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux