All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Disseldorp <ddiss@suse.de>
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
Subject: Re: [PATCH 1/3] kstrtox: introduce a safer version of memparse()
Date: Thu, 28 Dec 2023 00:26:03 +1100	[thread overview]
Message-ID: <20231228002603.059bfb1c@echidna> (raw)
In-Reply-To: <7fd6e5cf2b7258c3c076334f443d5fee7b1086d6.1703324146.git.wqu@suse.com>

On Sat, 23 Dec 2023 20:28:05 +1030, Qu Wenruo wrote:

> +	s = _parse_integer_fixup_radix(s, &base);
> +	rv = _parse_integer(s, base, &value);
> +	if (rv & KSTRTOX_OVERFLOW)
> +		return -ERANGE;
> +	if (rv == 0)
> +		return -EINVAL;

I was playing around with your unit tests and noticed that "0xG" didn't
reach the expected rv == 0 -> -EINVAL above. It seems that
_parse_integer_fixup_radix() should handle 0x<non hex> differently, or
at least step past any autodetected '0' octal prefix.

Cheers, David

  reply	other threads:[~2023-12-27 13:34 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-23  9:58 [PATCH 0/3] kstrtox: introduce memparse_safe() Qu Wenruo
2023-12-23  9:58 ` [PATCH 1/3] kstrtox: introduce a safer version of memparse() Qu Wenruo
2023-12-27 13:26   ` David Disseldorp [this message]
2023-12-27 20:29     ` Qu Wenruo
2023-12-23  9:58 ` [PATCH 2/3] kstrtox: add unit tests for memparse_safe() Qu Wenruo
2023-12-26  6:36   ` kernel test robot
2023-12-26  7:37     ` Qu Wenruo
2024-01-02  1:33       ` Yujie Liu
2024-01-02  2:03         ` Qu Wenruo
2023-12-23  9:58 ` [PATCH 3/3] btrfs: migrate to the newer memparse_safe() helper Qu Wenruo
2023-12-26  4:53   ` kernel test robot
2023-12-26  6:06   ` kernel test robot
2023-12-27  6:27   ` David Disseldorp
2023-12-27  8:26     ` Qu Wenruo
2023-12-27 16:12 ` [PATCH 0/3] 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=20231228002603.059bfb1c@echidna \
    --to=ddiss@suse.de \
    --cc=David.Laight@ACULAB.COM \
    --cc=akpm@linux-foundation.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.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.