[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260204135717.941256-4-dmantipov@yandex.ru>
Date: Wed, 4 Feb 2026 16:57:15 +0300
From: Dmitry Antipov <dmantipov@...dex.ru>
To: Andy Shevchenko <andriy.shevchenko@...el.com>,
Andrew Morton <akpm@...ux-foundation.org>
Cc: Kees Cook <kees@...nel.org>,
"Darrick J . Wong" <djwong@...nel.org>,
linux-hardening@...r.kernel.org,
linux-kernel@...r.kernel.org,
Dmitry Antipov <dmantipov@...dex.ru>
Subject: [PATCH v5 3/5] lib: add more string to 64-bit integer conversion overflow tests
Add a few more string to 64-bit integer conversion tests to
check whether 'kstrtoull()', 'kstrtoll()', 'kstrtou64()' and
'kstrtos64()' can handle overflows reported by
'_parse_integer_limit()'.
Suggested-by: Andy Shevchenko <andriy.shevchenko@...el.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@...el.com>
Signed-off-by: Dmitry Antipov <dmantipov@...dex.ru>
---
v5: bump version to match the series
v4: initial version to join the series
---
lib/test-kstrtox.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/lib/test-kstrtox.c b/lib/test-kstrtox.c
index ee87fef66cb5..811128d0df16 100644
--- a/lib/test-kstrtox.c
+++ b/lib/test-kstrtox.c
@@ -198,6 +198,7 @@ static void __init test_kstrtoull_fail(void)
{"10000000000000000000000000000000000000000000000000000000000000000", 2},
{"2000000000000000000000", 8},
{"18446744073709551616", 10},
+ {"569202370375329612767", 10},
{"10000000000000000", 16},
/* negative */
{"-0", 0},
@@ -275,9 +276,11 @@ static void __init test_kstrtoll_fail(void)
{"9223372036854775809", 10},
{"18446744073709551614", 10},
{"18446744073709551615", 10},
+ {"569202370375329612767", 10},
{"-9223372036854775809", 10},
{"-18446744073709551614", 10},
{"-18446744073709551615", 10},
+ {"-569202370375329612767", 10},
/* sign is first character if any */
{"-+1", 0},
{"-+1", 8},
@@ -334,6 +337,7 @@ static void __init test_kstrtou64_fail(void)
{"-1", 10},
{"18446744073709551616", 10},
{"18446744073709551617", 10},
+ {"569202370375329612767", 10},
};
TEST_FAIL(kstrtou64, u64, "%llu", test_u64_fail);
}
@@ -386,6 +390,8 @@ static void __init test_kstrtos64_fail(void)
{"18446744073709551615", 10},
{"18446744073709551616", 10},
{"18446744073709551617", 10},
+ {"569202370375329612767", 10},
+ {"-569202370375329612767", 10},
};
TEST_FAIL(kstrtos64, s64, "%lld", test_s64_fail);
}
--
2.52.0
Powered by blists - more mailing lists