Merge tag 'random-6.1-rc1-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[linux-block.git] / mm / kasan / kasan_test.c
index 57e4c72aa8bd2634cc00aac679e98559391f37ea..0d59098f087613d11ef37cdd02c50894eb67e9e1 100644 (file)
@@ -1299,7 +1299,7 @@ static void match_all_not_assigned(struct kunit *test)
        KASAN_TEST_NEEDS_CONFIG_OFF(test, CONFIG_KASAN_GENERIC);
 
        for (i = 0; i < 256; i++) {
-               size = (get_random_int() % 1024) + 1;
+               size = prandom_u32_max(1024) + 1;
                ptr = kmalloc(size, GFP_KERNEL);
                KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr);
                KUNIT_EXPECT_GE(test, (u8)get_tag(ptr), (u8)KASAN_TAG_MIN);
@@ -1308,7 +1308,7 @@ static void match_all_not_assigned(struct kunit *test)
        }
 
        for (i = 0; i < 256; i++) {
-               order = (get_random_int() % 4) + 1;
+               order = prandom_u32_max(4) + 1;
                pages = alloc_pages(GFP_KERNEL, order);
                ptr = page_address(pages);
                KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr);
@@ -1321,7 +1321,7 @@ static void match_all_not_assigned(struct kunit *test)
                return;
 
        for (i = 0; i < 256; i++) {
-               size = (get_random_int() % 1024) + 1;
+               size = prandom_u32_max(1024) + 1;
                ptr = vmalloc(size);
                KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr);
                KUNIT_EXPECT_GE(test, (u8)get_tag(ptr), (u8)KASAN_TAG_MIN);