From: David Sterba <dsterba@suse.cz>
To: Anand Jain <anand.jain@oracle.com>
Cc: dsterba@suse.cz, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH v2 2/2] btrfs: verify max_inline mount parameter
Date: Thu, 15 Feb 2018 17:43:38 +0100 [thread overview]
Message-ID: <20180215164338.GC10193@twin.jikos.cz> (raw)
In-Reply-To: <74fb8a4b-24d7-7871-8050-2c4e3113580c@oracle.com>
On Thu, Feb 15, 2018 at 01:20:55AM +0800, Anand Jain wrote:
>
>
> On 02/14/2018 12:28 AM, David Sterba wrote:
> > On Tue, Feb 13, 2018 at 05:49:50PM +0800, Anand Jain wrote:
> >> We aren't verifying the parameter passed to the max_inline mount option,
> >> so we won't report and fail the mount if a junk value is specified for
> >> example, -o max_inline=abc.
> >> This patch converts the max_inline option to %d and checks if it's a
> >> number >= 0.
> >
> > As the max_inline is a size, the suffixes are allowed here and this is
> > documented in the btrfs(5) page. I've checked all current options and
> > max_inline should be the only one where we want the suffixes.
>
> Oh. I ran out of ideas how to fix this.
> One idea is ... step1: memparse() 4K (for example) so we would get
> 4096, step2: convert obtained 4096 back to 4K and step3: do string cmp
> of step1 and step2. This way we eliminate other junk chars passed.
> But looks like there isn't any tool to do the step2.
Memparse has 2nd parameter that will point after the parsed string, so
we can check if it's empty. This is already done in the resize string
parsing (in btrfs_ioctl_resize), but missing from other memparse uses.
next prev parent reply other threads:[~2018-02-15 16:45 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-13 9:49 [PATCH v2 1/2] btrfs: declare max_inline as u32 Anand Jain
2018-02-13 9:49 ` [PATCH v2 2/2] btrfs: verify max_inline mount parameter Anand Jain
2018-02-13 16:28 ` David Sterba
2018-02-14 17:20 ` Anand Jain
2018-02-15 16:43 ` David Sterba [this message]
2018-02-26 2:47 ` [PATCH v3] " Anand Jain
2018-02-27 15:45 ` David Sterba
2018-03-01 11:51 ` Anand Jain
2018-03-05 21:34 ` David Sterba
2018-02-13 16:28 ` [PATCH v2 1/2] btrfs: declare max_inline as u32 David Sterba
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180215164338.GC10193@twin.jikos.cz \
--to=dsterba@suse.cz \
--cc=anand.jain@oracle.com \
--cc=linux-btrfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).