diff options
| author | Rasmus Villemoes <[email protected]> | 2016-01-16 00:59:06 +0000 |
|---|---|---|
| committer | Linus Torvalds <[email protected]> | 2016-01-16 19:17:29 +0000 |
| commit | 857cca4d565d85857597ccf0b6f72cf0f06e046c (patch) | |
| tree | 7a6e92ed503c2bc4328da3c34ba24dbd50a5ce5d /lib/test_printf.c | |
| parent | lib/test_printf.c: account for kvasprintf tests (diff) | |
| download | kernel-857cca4d565d85857597ccf0b6f72cf0f06e046c.tar.gz kernel-857cca4d565d85857597ccf0b6f72cf0f06e046c.zip | |
lib/test_printf.c: add test for large bitmaps
Following "lib/vsprintf.c: expand field_width to 24 bits", let's add a
test to see that we now actually support bitmaps with 65536 bits.
Signed-off-by: Rasmus Villemoes <[email protected]>
Acked-by: Kees Cook <[email protected]>
Cc: Al Viro <[email protected]>
Cc: Andy Shevchenko <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Joe Perches <[email protected]>
Cc: Maurizio Lombardi <[email protected]>
Cc: Tejun Heo <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Diffstat (limited to 'lib/test_printf.c')
| -rw-r--r-- | lib/test_printf.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/test_printf.c b/lib/test_printf.c index 3e21170d327d..60740c10c3e8 100644 --- a/lib/test_printf.c +++ b/lib/test_printf.c @@ -12,6 +12,7 @@ #include <linux/slab.h> #include <linux/string.h> +#include <linux/bitmap.h> #include <linux/socket.h> #include <linux/in.h> @@ -341,6 +342,20 @@ struct_clk(void) } static void __init +large_bitmap(void) +{ + const int nbits = 1 << 16; + unsigned long *bits = kcalloc(BITS_TO_LONGS(nbits), sizeof(long), GFP_KERNEL); + if (!bits) + return; + + bitmap_set(bits, 1, 20); + bitmap_set(bits, 60000, 15); + test("1-20,60000-60014", "%*pbl", nbits, bits); + kfree(bits); +} + +static void __init bitmap(void) { DECLARE_BITMAP(bits, 20); @@ -359,6 +374,8 @@ bitmap(void) bitmap_fill(bits, 20); test("fffff|fffff", "%20pb|%*pb", bits, 20, bits); test("0-19|0-19", "%20pbl|%*pbl", bits, 20, bits); + + large_bitmap(); } static void __init |
