]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
binder: Fix selftest page indexing
authorTiffany Yang <ynaffit@google.com>
Mon, 14 Jul 2025 18:53:14 +0000 (11:53 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 16 Jul 2025 12:11:58 +0000 (14:11 +0200)
The binder allocator selftest was only checking the last page of buffers
that ended on a page boundary. Correct the page indexing to account for
buffers that are not page-aligned.

Signed-off-by: Tiffany Yang <ynaffit@google.com>
Acked-by: Carlos Llamas <cmllamas@google.com>
Link: https://lore.kernel.org/r/20250714185321.2417234-2-ynaffit@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/android/binder_alloc_selftest.c

index c88735c548485466f485dd9d66501899a46a7731..486af3ec3c02722fc826e51a48b16c1c816f1413 100644 (file)
@@ -142,12 +142,12 @@ static void binder_selftest_free_buf(struct binder_alloc *alloc,
        for (i = 0; i < BUFFER_NUM; i++)
                binder_alloc_free_buf(alloc, buffers[seq[i]]);
 
-       for (i = 0; i < end / PAGE_SIZE; i++) {
                /**
                 * Error message on a free page can be false positive
                 * if binder shrinker ran during binder_alloc_free_buf
                 * calls above.
                 */
+       for (i = 0; i <= (end - 1) / PAGE_SIZE; i++) {
                if (list_empty(page_to_lru(alloc->pages[i]))) {
                        pr_err_size_seq(sizes, seq);
                        pr_err("expect lru but is %s at page index %d\n",