summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYury Norov <yury.norov@gmail.com>2020-01-03 16:25:22 +1100
committerStephen Rothwell <sfr@canb.auug.org.au>2020-01-06 16:49:08 +1100
commite3dea7370ac1e51d7226d0b65f6b67e143af58f0 (patch)
tree558287233c547c2bf9bba108a4961683f50ca18c
parentfb2951c8025d64b36a622b794e29ffd30634b65f (diff)
downloadlinux-next-e3dea7370ac1e51d7226d0b65f6b67e143af58f0.tar.gz
lib: new testcases for bitmap_parse{_user}
New version of bitmap_parse() is unified with bitmap_parse_list(), and therefore: - weakens rules on whitespaces and commas between hex chunks; - in addition to - allows passing UINT_MAX or any other big number as the length of input string instead of actual string length. The patch covers the cases. Link: http://lkml.kernel.org/r/20200102043031.30357-7-yury.norov@gmail.com Signed-off-by: Yury Norov <yury.norov@gmail.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Cc: Amritha Nambiar <amritha.nambiar@intel.com> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Cc: Kees Cook <keescook@chromium.org> Cc: Matthew Wilcox <willy@infradead.org> Cc: Miklos Szeredi <mszeredi@redhat.com> Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk> Cc: Steffen Klassert <steffen.klassert@secunet.com> Cc: "Tobin C . Harding" <tobin@kernel.org> Cc: Vineet Gupta <vineet.gupta1@synopsys.com> Cc: Will Deacon <will.deacon@arm.com> Cc: Willem de Bruijn <willemb@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
-rw-r--r--lib/test_bitmap.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/test_bitmap.c b/lib/test_bitmap.c
index a4ecf6f04a5b..5cb35a734462 100644
--- a/lib/test_bitmap.c
+++ b/lib/test_bitmap.c
@@ -414,14 +414,22 @@ static const unsigned long parse_test2[] __initconst = {
};
static const struct test_bitmap_parselist parse_tests[] __initconst = {
+ {0, "", &parse_test[0 * step], 32, 0},
+ {0, " ", &parse_test[0 * step], 32, 0},
{0, "0", &parse_test[0 * step], 32, 0},
+ {0, "0\n", &parse_test[0 * step], 32, 0},
{0, "1", &parse_test[1 * step], 32, 0},
{0, "deadbeef", &parse_test[2 * step], 32, 0},
{0, "1,0", &parse_test[3 * step], 33, 0},
+ {0, "deadbeef,\n,0,1", &parse_test[2 * step], 96, 0},
{0, "deadbeef,1,0", &parse_test2[0 * 2 * step], 96, 0},
{0, "baadf00d,deadbeef,1,0", &parse_test2[1 * 2 * step], 128, 0},
{0, "badf00d,deadbeef,1,0", &parse_test2[2 * 2 * step], 124, 0},
+ {0, "badf00d,deadbeef,1,0", &parse_test2[2 * 2 * step], 124, NO_LEN},
+ {0, " badf00d,deadbeef,1,0 ", &parse_test2[2 * 2 * step], 124, 0},
+ {0, " , badf00d,deadbeef,1,0 , ", &parse_test2[2 * 2 * step], 124, 0},
+ {0, " , badf00d, ,, ,,deadbeef,1,0 , ", &parse_test2[2 * 2 * step], 124, 0},
{-EINVAL, "goodfood,deadbeef,1,0", NULL, 128, 0},
{-EOVERFLOW, "3,0", NULL, 33, 0},