From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Dmitry Antipov <dmantipov@yandex.ru>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Petr Mladek <pmladek@suse.com>,
linux-kernel@vger.kernel.org
Cc: Andrew Morton <akpm@linux-foundation.org>,
Steven Rostedt <rostedt@goodmis.org>,
Rasmus Villemoes <linux@rasmusvillemoes.dk>,
Sergey Senozhatsky <senozhatsky@chromium.org>,
rodrigo.alencar@analog.com, dlechner@baylibre.com,
jic23@kernel.org
Subject: [PATCH v1 2/2] vsprintf: Convert to use _parse_integer() instead of _parse_integer_limit()
Date: Tue, 2 Jun 2026 22:29:47 +0200 [thread overview]
Message-ID: <20260602203706.103449-3-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <20260602203706.103449-1-andriy.shevchenko@linux.intel.com>
Use _parse_integer() that allows optional arguments to be explicitly
initialised.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
lib/kstrtox.h | 3 +++
lib/vsprintf.c | 2 +-
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/lib/kstrtox.h b/lib/kstrtox.h
index 6c7ca3b67429..4299b1f92133 100644
--- a/lib/kstrtox.h
+++ b/lib/kstrtox.h
@@ -12,6 +12,9 @@ unsigned int _parse_integer_limit(const char *s, unsigned int base, unsigned lon
#define _parse_integer0(s, base, res, ...) \
_parse_integer_limit(s, base, res, INT_MAX);
+#define _parse_integer1(s, base, res, max_chars, ...) \
+ _parse_integer_limit(s, base, res, max_chars);
+
#define _parse_integer(s, base, res, ...) \
CONCATENATE(_parse_integer, COUNT_ARGS(__VA_ARGS__))(s, base, res, __VA_ARGS__)
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index a3017bc58986..1389b50266bf 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -86,7 +86,7 @@ static unsigned long long simple_strntoull(const char *startp, char **endp, unsi
cp = _parse_integer_fixup_radix(startp, &base);
prefix_chars = cp - startp;
if (prefix_chars < max_chars) {
- rv = _parse_integer_limit(cp, base, &result, max_chars - prefix_chars);
+ rv = _parse_integer(cp, base, &result, max_chars - prefix_chars);
/* FIXME */
cp += (rv & ~KSTRTOX_OVERFLOW);
} else {
--
2.50.1
next prev parent reply other threads:[~2026-06-02 20:37 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-02 20:29 [PATCH v1 0/2] kstrtox: make _parse_integer() flexible Andy Shevchenko
2026-06-02 20:29 ` [PATCH v1 1/2] kstrtox: Make _parse_integer() take variadic arguments Andy Shevchenko
2026-06-03 6:47 ` Andy Shevchenko
2026-06-03 10:37 ` David Laight
2026-06-03 10:54 ` Andy Shevchenko
2026-06-03 10:56 ` Andy Shevchenko
2026-06-03 11:34 ` David Laight
2026-06-02 20:29 ` Andy Shevchenko [this message]
2026-06-03 11:23 ` [PATCH v1 0/2] kstrtox: make _parse_integer() flexible Petr Mladek
2026-06-03 11:51 ` Rodrigo Alencar
2026-06-03 12:10 ` Rodrigo Alencar
2026-06-03 13:58 ` Andy Shevchenko
2026-06-03 13:53 ` Andy Shevchenko
2026-06-04 6:59 ` Petr Mladek
2026-06-04 7:19 ` Andy Shevchenko
2026-06-04 7:48 ` Rodrigo Alencar
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=20260602203706.103449-3-andriy.shevchenko@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=akpm@linux-foundation.org \
--cc=dlechner@baylibre.com \
--cc=dmantipov@yandex.ru \
--cc=jic23@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@rasmusvillemoes.dk \
--cc=pmladek@suse.com \
--cc=rodrigo.alencar@analog.com \
--cc=rostedt@goodmis.org \
--cc=senozhatsky@chromium.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