From: David Sterba <dsterba@suse.cz>
To: Qu Wenruo <wqu@suse.com>
Cc: linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org,
akpm@linux-foundation.org, christophe.jaillet@wanadoo.fr,
andriy.shevchenko@linux.intel.com, David.Laight@ACULAB.COM,
ddiss@suse.de, geert@linux-m68k.org, rdunlap@infradead.org
Subject: Re: [PATCH v4 4/4] btrfs: migrate to the newer memparse_safe() helper
Date: Fri, 5 Jan 2024 20:04:02 +0100 [thread overview]
Message-ID: <20240105190402.GA28693@suse.cz> (raw)
In-Reply-To: <0c006657fd7d5d923e135bdd4cecc5bcf6a01451.1704422015.git.wqu@suse.com>
On Fri, Jan 05, 2024 at 01:05:02PM +1030, Qu Wenruo wrote:
> The new helper has better error report and correct overflow detection,
> furthermore the old @retptr behavior is also kept, thus there should be
> no behavior change.
>
> Signed-off-by: Qu Wenruo <wqu@suse.com>
> Reviewed-by: David Disseldorp <ddiss@suse.de>
> ---
> fs/btrfs/ioctl.c | 6 +++++-
> fs/btrfs/super.c | 9 ++++++++-
> fs/btrfs/sysfs.c | 14 +++++++++++---
> 3 files changed, 24 insertions(+), 5 deletions(-)
>
> diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
> index 4e50b62db2a8..cb63f50a2078 100644
> --- a/fs/btrfs/ioctl.c
> +++ b/fs/btrfs/ioctl.c
> @@ -1175,7 +1175,11 @@ static noinline int btrfs_ioctl_resize(struct file *file,
> mod = 1;
> sizestr++;
> }
> - new_size = memparse(sizestr, &retptr);
> +
> + ret = memparse_safe(sizestr, MEMPARSE_SUFFIXES_DEFAULT,
> + &new_size, &retptr);
> + if (ret < 0)
> + goto out_finish;
> if (*retptr != '\0' || new_size == 0) {
> ret = -EINVAL;
> goto out_finish;
> diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
> index 3a677b808f0f..0f29fd692e0f 100644
> --- a/fs/btrfs/super.c
> +++ b/fs/btrfs/super.c
> @@ -263,6 +263,8 @@ static int btrfs_parse_param(struct fs_context *fc, struct fs_parameter *param)
> {
> struct btrfs_fs_context *ctx = fc->fs_private;
> struct fs_parse_result result;
> + /* Only for memparse_safe() caller. */
Please drop the comment.
next prev parent reply other threads:[~2024-01-05 19:04 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-05 2:34 [PATCH v4 0/4] kstrtox: introduce memparse_safe() Qu Wenruo
2024-01-05 2:34 ` [PATCH v4 1/4] kstrtox: always skip the leading "0x" even if no more valid chars Qu Wenruo
2024-01-05 2:35 ` [PATCH v4 2/4] kstrtox: introduce a safer version of memparse() Qu Wenruo
2024-01-15 4:27 ` Randy Dunlap
2024-01-15 5:27 ` Qu Wenruo
2024-01-18 17:52 ` Randy Dunlap
2024-01-05 2:35 ` [PATCH v4 3/4] kstrtox: add unit tests for memparse_safe() Qu Wenruo
2024-01-05 2:35 ` [PATCH v4 4/4] btrfs: migrate to the newer memparse_safe() helper Qu Wenruo
2024-01-05 19:04 ` David Sterba [this message]
2024-01-06 14:35 ` [PATCH v4 0/4] kstrtox: introduce memparse_safe() Andy Shevchenko
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=20240105190402.GA28693@suse.cz \
--to=dsterba@suse.cz \
--cc=David.Laight@ACULAB.COM \
--cc=akpm@linux-foundation.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=christophe.jaillet@wanadoo.fr \
--cc=ddiss@suse.de \
--cc=geert@linux-m68k.org \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rdunlap@infradead.org \
--cc=wqu@suse.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.