selftest.c (6ce625939e58174df5a006ba8aa9d4c0013dfcf8) selftest.c (8032bf1233a74627ce69b803608e650f3f35971c)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * KCSAN short boot-time selftests.
4 *
5 * Copyright (C) 2019, Google LLC.
6 */
7
8#define pr_fmt(fmt) "kcsan: " fmt

--- 17 unchanged lines hidden (view full) ---

26 * Test watchpoint encode and decode: check that encoding some access's info,
27 * and then subsequent decode preserves the access's info.
28 */
29static bool __init test_encode_decode(void)
30{
31 int i;
32
33 for (i = 0; i < ITERS_PER_TEST; ++i) {
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * KCSAN short boot-time selftests.
4 *
5 * Copyright (C) 2019, Google LLC.
6 */
7
8#define pr_fmt(fmt) "kcsan: " fmt

--- 17 unchanged lines hidden (view full) ---

26 * Test watchpoint encode and decode: check that encoding some access's info,
27 * and then subsequent decode preserves the access's info.
28 */
29static bool __init test_encode_decode(void)
30{
31 int i;
32
33 for (i = 0; i < ITERS_PER_TEST; ++i) {
34 size_t size = prandom_u32_max(MAX_ENCODABLE_SIZE) + 1;
35 bool is_write = !!prandom_u32_max(2);
34 size_t size = get_random_u32_below(MAX_ENCODABLE_SIZE) + 1;
35 bool is_write = !!get_random_u32_below(2);
36 unsigned long verif_masked_addr;
37 long encoded_watchpoint;
38 bool verif_is_write;
39 unsigned long addr;
40 size_t verif_size;
41
42 get_random_bytes(&addr, sizeof(addr));
43 if (addr < PAGE_SIZE)

--- 221 unchanged lines hidden ---
36 unsigned long verif_masked_addr;
37 long encoded_watchpoint;
38 bool verif_is_write;
39 unsigned long addr;
40 size_t verif_size;
41
42 get_random_bytes(&addr, sizeof(addr));
43 if (addr < PAGE_SIZE)

--- 221 unchanged lines hidden ---