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 <[email protected]>
Signed-off-by: Dmitry Antipov <[email protected]>
---
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


Reply via email to