xfs
[Top] [All Lists]

Re: [PATCH 06/15] mkfs: validate logarithmic parameters sanely

To: Dave Chinner <david@xxxxxxxxxxxxx>
Subject: Re: [PATCH 06/15] mkfs: validate logarithmic parameters sanely
From: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Date: Mon, 2 Dec 2013 09:06:01 -0800
Cc: xfs@xxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <1385689430-10103-7-git-send-email-david@xxxxxxxxxxxxx>
References: <1385689430-10103-1-git-send-email-david@xxxxxxxxxxxxx> <1385689430-10103-7-git-send-email-david@xxxxxxxxxxxxx>
User-agent: Mutt/1.5.21 (2010-09-15)
On Fri, Nov 29, 2013 at 12:43:41PM +1100, Dave Chinner wrote:
> From: Dave Chinner <dchinner@xxxxxxxxxx>
> 
> Testing logarithmic paramters like "-n log=<num>" shows that we do a
> terrible job of validating such input. e.g.:
> 
> # mkfs.xfs -f -n log=456858480 /dev/vda
> .....
> naming   =version 2              bsize=65536  ascii-ci=0 ftype=0
> ....
> 
> Yeah, I just asked for a block size of 2^456858480, and it didn't
> get rejected. Great, isn't it?
> 
> So, factor out the parsing of logarithmic parameters, and pass in
> the maximum valid value that they can take. These maximum values
> might not be completely accurate (e.g. block/sector sizes will
> affect the eventual valid maximum) but we can get rid of all the
> overflows and stupidities before we get to fine-grained validity
> checking later in mkfs once things like block and sector sizes have
> been finalised.

Btw, is there any good reason not to deprecate the logarithmic
parameters?  I can't see why anyone would want to use them, but I see
lots of potential for confusion (happened to myself in the past).

The patch itself looks good:


Reviewed-by: Christoph Hellwig <hch@xxxxxx>

<Prev in Thread] Current Thread [Next in Thread>