]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
bitmap: switch test to scnprintf("%*pbl")
authorYury Norov <ynorov@nvidia.com>
Thu, 19 Feb 2026 18:13:57 +0000 (13:13 -0500)
committerYury Norov <ynorov@nvidia.com>
Mon, 23 Mar 2026 17:33:51 +0000 (13:33 -0400)
scnprintf("%*pbl") is more verbose than bitmap_print_to_pagebuf().
Switch the test to using it. This also improves the test output
because bitmap_print_to_pagebuf() adds \n at the end of the printed
bitmap, which breaks the test format.

Signed-off-by: Yury Norov <ynorov@nvidia.com>
lib/test_bitmap.c

index 2952a6147e81c4dd07c8f4f4103e3e3923d6f322..8d07b5411897d2e5c34102931bdab28b0ecd0dc7 100644 (file)
@@ -548,22 +548,22 @@ static void __init test_bitmap_printlist(void)
                goto out;
 
        time = ktime_get();
-       ret = bitmap_print_to_pagebuf(true, buf, bmap, PAGE_SIZE * 8);
+       ret = scnprintf(buf, PAGE_SIZE, "%*pbl", (int)PAGE_SIZE * 8, bmap);
        time = ktime_get() - time;
 
-       if (ret != slen + 1) {
-               pr_err("bitmap_print_to_pagebuf: result is %d, expected %d\n", ret, slen);
+       if (ret != slen) {
+               pr_err("bitmap_printlist: result is %d, expected %d\n", ret, slen);
                failed_tests++;
                goto out;
        }
 
        if (strncmp(buf, expected, slen)) {
-               pr_err("bitmap_print_to_pagebuf: result is %s, expected %s\n", buf, expected);
+               pr_err("bitmap_printlist: result is %s, expected %s\n", buf, expected);
                failed_tests++;
                goto out;
        }
 
-       pr_info("bitmap_print_to_pagebuf: input is '%s', Time: %llu\n", buf, time);
+       pr_info("bitmap_printlist: input is '%s', Time: %llu\n", buf, time);
 out:
        kfree(buf);
        kfree(bmap);