Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests/bpf: fix some typos in selftests

Hi, fix some spelling errors in selftest, the details are as follows:

-in the codes:
test_bpf_sk_stoarge_map_iter_fd(void)
->test_bpf_sk_storage_map_iter_fd(void)
load BTF from btf_data.o->load BTF from btf_data.bpf.o

-in the code comments:
preample->preamble
multi-contollers->multi-controllers
errono->errno
unsighed/unsinged->unsigned
egree->egress
shoud->should
regsiter->register
assummed->assumed
conditiona->conditional
rougly->roughly
timetamp->timestamp
ingores->ignores
null-termainted->null-terminated
slepable->sleepable
implemenation->implementation
veriables->variables
timetamps->timestamps
substitue a costant->substitute a constant
secton->section
unreferened->unreferenced
verifer->verifier
libppf->libbpf
...

Signed-off-by: Lin Yikai <yikai.lin@vivo.com>
Link: https://lore.kernel.org/r/20240905110354.3274546-1-yikai.lin@vivo.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>

authored by

Lin Yikai and committed by
Alexei Starovoitov
5db0ba67 552895af

+39 -39
+1 -1
tools/testing/selftests/bpf/benchs/bench_trigger.c
··· 276 276 * instructions. So use two different targets, one of which starts with nop 277 277 * and another doesn't. 278 278 * 279 - * GCC doesn't generate stack setup preample for these functions due to them 279 + * GCC doesn't generate stack setup preamble for these functions due to them 280 280 * having no input arguments and doing nothing in the body. 281 281 */ 282 282 __nocf_check __weak void uprobe_target_nop(void)
+1 -1
tools/testing/selftests/bpf/cgroup_helpers.c
··· 644 644 /** 645 645 * get_cgroup1_hierarchy_id - Retrieves the ID of a cgroup1 hierarchy from the cgroup1 subsys name. 646 646 * @subsys_name: The cgroup1 subsys name, which can be retrieved from /proc/self/cgroup. It can be 647 - * a named cgroup like "name=systemd", a controller name like "net_cls", or multi-contollers like 647 + * a named cgroup like "name=systemd", a controller name like "net_cls", or multi-controllers like 648 648 * "net_cls,net_prio". 649 649 */ 650 650 int get_cgroup1_hierarchy_id(const char *subsys_name)
+1 -1
tools/testing/selftests/bpf/map_tests/htab_map_batch_ops.c
··· 197 197 CHECK(total != max_entries, "delete with steps", 198 198 "total = %u, max_entries = %u\n", total, max_entries); 199 199 200 - /* check map is empty, errono == ENOENT */ 200 + /* check map is empty, errno == ENOENT */ 201 201 err = bpf_map_get_next_key(map_fd, NULL, &key); 202 202 CHECK(!err || errno != ENOENT, "bpf_map_get_next_key()", 203 203 "error: %s\n", strerror(errno));
+1 -1
tools/testing/selftests/bpf/map_tests/lpm_trie_map_batch_ops.c
··· 135 135 CHECK(total != max_entries, "delete with steps", 136 136 "total = %u, max_entries = %u\n", total, max_entries); 137 137 138 - /* check map is empty, errono == ENOENT */ 138 + /* check map is empty, errno == ENOENT */ 139 139 err = bpf_map_get_next_key(map_fd, NULL, &key); 140 140 CHECK(!err || errno != ENOENT, "bpf_map_get_next_key()", 141 141 "error: %s\n", strerror(errno));
+2 -2
tools/testing/selftests/bpf/prog_tests/bpf_iter.c
··· 1218 1218 bpf_iter_bpf_sk_storage_helpers__destroy(skel); 1219 1219 } 1220 1220 1221 - static void test_bpf_sk_stoarge_map_iter_fd(void) 1221 + static void test_bpf_sk_storage_map_iter_fd(void) 1222 1222 { 1223 1223 struct bpf_iter_bpf_sk_storage_map *skel; 1224 1224 ··· 1693 1693 if (test__start_subtest("bpf_sk_storage_map")) 1694 1694 test_bpf_sk_storage_map(); 1695 1695 if (test__start_subtest("bpf_sk_storage_map_iter_fd")) 1696 - test_bpf_sk_stoarge_map_iter_fd(); 1696 + test_bpf_sk_storage_map_iter_fd(); 1697 1697 if (test__start_subtest("bpf_sk_storage_delete")) 1698 1698 test_bpf_sk_storage_delete(); 1699 1699 if (test__start_subtest("bpf_sk_storage_get"))
+3 -3
tools/testing/selftests/bpf/prog_tests/btf.c
··· 4986 4986 static struct btf_raw_test pprint_test_template[] = { 4987 4987 { 4988 4988 .raw_types = { 4989 - /* unsighed char */ /* [1] */ 4989 + /* unsigned char */ /* [1] */ 4990 4990 BTF_TYPE_INT_ENC(NAME_TBD, 0, 0, 8, 1), 4991 4991 /* unsigned short */ /* [2] */ 4992 4992 BTF_TYPE_INT_ENC(NAME_TBD, 0, 0, 16, 2), ··· 5053 5053 * be encoded with kind_flag set. 5054 5054 */ 5055 5055 .raw_types = { 5056 - /* unsighed char */ /* [1] */ 5056 + /* unsigned char */ /* [1] */ 5057 5057 BTF_TYPE_INT_ENC(NAME_TBD, 0, 0, 8, 1), 5058 5058 /* unsigned short */ /* [2] */ 5059 5059 BTF_TYPE_INT_ENC(NAME_TBD, 0, 0, 16, 2), ··· 5120 5120 * will have both int and enum types. 5121 5121 */ 5122 5122 .raw_types = { 5123 - /* unsighed char */ /* [1] */ 5123 + /* unsigned char */ /* [1] */ 5124 5124 BTF_TYPE_INT_ENC(NAME_TBD, 0, 0, 8, 1), 5125 5125 /* unsigned short */ /* [2] */ 5126 5126 BTF_TYPE_INT_ENC(NAME_TBD, 0, 0, 16, 2),
+1 -1
tools/testing/selftests/bpf/prog_tests/cg_storage_multi.c
··· 214 214 /* Attach to parent and child cgroup, trigger packet from child. 215 215 * Assert that there is six additional runs, parent cgroup egresses and 216 216 * ingress, child cgroup egresses and ingress. 217 - * Assert that egree and ingress storages are separate. 217 + * Assert that egress and ingress storages are separate. 218 218 */ 219 219 child_egress1_link = bpf_program__attach_cgroup(obj->progs.egress1, 220 220 child_cgroup_fd);
+2 -2
tools/testing/selftests/bpf/prog_tests/log_buf.c
··· 160 160 opts.log_buf = log_buf; 161 161 opts.log_size = log_buf_sz; 162 162 163 - /* with log_level == 0 log_buf shoud stay empty for good prog */ 163 + /* with log_level == 0 log_buf should stay empty for good prog */ 164 164 log_buf[0] = '\0'; 165 165 opts.log_level = 0; 166 166 fd = bpf_prog_load(BPF_PROG_TYPE_SOCKET_FILTER, "good_prog", "GPL", ··· 222 222 opts.log_buf = log_buf; 223 223 opts.log_size = log_buf_sz; 224 224 225 - /* with log_level == 0 log_buf shoud stay empty for good BTF */ 225 + /* with log_level == 0 log_buf should stay empty for good BTF */ 226 226 log_buf[0] = '\0'; 227 227 opts.log_level = 0; 228 228 fd = bpf_btf_load(raw_btf_data, raw_btf_size, &opts);
+7 -7
tools/testing/selftests/bpf/prog_tests/reg_bounds.c
··· 503 503 504 504 /* Can register with range [x.a, x.b] *EVER* satisfy 505 505 * OP (<, <=, >, >=, ==, !=) relation to 506 - * a regsiter with range [y.a, y.b] 506 + * a register with range [y.a, y.b] 507 507 * _in *num_t* domain_ 508 508 */ 509 509 static bool range_canbe_op(enum num_t t, struct range x, struct range y, enum op op) ··· 532 532 533 533 /* Does register with range [x.a, x.b] *ALWAYS* satisfy 534 534 * OP (<, <=, >, >=, ==, !=) relation to 535 - * a regsiter with range [y.a, y.b] 535 + * a register with range [y.a, y.b] 536 536 * _in *num_t* domain_ 537 537 */ 538 538 static bool range_always_op(enum num_t t, struct range x, struct range y, enum op op) ··· 543 543 544 544 /* Does register with range [x.a, x.b] *NEVER* satisfy 545 545 * OP (<, <=, >, >=, ==, !=) relation to 546 - * a regsiter with range [y.a, y.b] 546 + * a register with range [y.a, y.b] 547 547 * _in *num_t* domain_ 548 548 */ 549 549 static bool range_never_op(enum num_t t, struct range x, struct range y, enum op op) ··· 1018 1018 * - umin=%llu, if missing, assumed 0; 1019 1019 * - umax=%llu, if missing, assumed U64_MAX; 1020 1020 * - smin=%lld, if missing, assumed S64_MIN; 1021 - * - smax=%lld, if missing, assummed S64_MAX; 1021 + * - smax=%lld, if missing, assumed S64_MAX; 1022 1022 * - umin32=%d, if missing, assumed 0; 1023 1023 * - umax32=%d, if missing, assumed U32_MAX; 1024 1024 * - smin32=%d, if missing, assumed S32_MIN; 1025 - * - smax32=%d, if missing, assummed S32_MAX; 1025 + * - smax32=%d, if missing, assumed S32_MAX; 1026 1026 * - var_off=(%#llx; %#llx), tnum part, we don't care about it. 1027 1027 * 1028 1028 * If some of the values are equal, they will be grouped (but min/max ··· 1884 1884 * envvar is not set, this test is skipped during test_progs testing. 1885 1885 * 1886 1886 * We split this up into smaller subsets based on initialization and 1887 - * conditiona numeric domains to get an easy parallelization with test_progs' 1887 + * conditional numeric domains to get an easy parallelization with test_progs' 1888 1888 * -j argument. 1889 1889 */ 1890 1890 ··· 1938 1938 { 1939 1939 /* RAND_MAX is guaranteed to be at least 1<<15, but in practice it 1940 1940 * seems to be 1<<31, so we need to call it thrice to get full u64; 1941 - * we'll use rougly equal split: 22 + 21 + 21 bits 1941 + * we'll use roughly equal split: 22 + 21 + 21 bits 1942 1942 */ 1943 1943 return ((u64)random() << 42) | 1944 1944 (((u64)random() & RAND_21BIT_MASK) << 21) |
+1 -1
tools/testing/selftests/bpf/prog_tests/resolve_btfids.c
··· 103 103 104 104 btf = btf__parse_elf("btf_data.bpf.o", NULL); 105 105 if (CHECK(libbpf_get_error(btf), "resolve", 106 - "Failed to load BTF from btf_data.o\n")) 106 + "Failed to load BTF from btf_data.bpf.o\n")) 107 107 return -1; 108 108 109 109 nr = btf__type_cnt(btf);
+1 -1
tools/testing/selftests/bpf/prog_tests/tc_redirect.c
··· 872 872 test_inet_dtime(family, SOCK_STREAM, addr, 50000 + t); 873 873 874 874 /* fwdns_prio100 prog does not read delivery_time_type, so 875 - * kernel puts the (rcv) timetamp in __sk_buff->tstamp 875 + * kernel puts the (rcv) timestamp in __sk_buff->tstamp 876 876 */ 877 877 ASSERT_EQ(dtimes[INGRESS_FWDNS_P100], 0, 878 878 dtime_cnt_str(t, INGRESS_FWDNS_P100));
+1 -1
tools/testing/selftests/bpf/prog_tests/test_bprm_opts.c
··· 51 51 exit(ret); 52 52 53 53 /* If the binary is executed with securexec=1, the dynamic 54 - * loader ingores and unsets certain variables like LD_PRELOAD, 54 + * loader ignores and unsets certain variables like LD_PRELOAD, 55 55 * TMPDIR etc. TMPDIR is used here to simplify the example, as 56 56 * LD_PRELOAD requires a real .so file. 57 57 *
+1 -1
tools/testing/selftests/bpf/prog_tests/test_strncmp.c
··· 72 72 got = trigger_strncmp(skel); 73 73 ASSERT_EQ(got, 0, "strncmp: same str"); 74 74 75 - /* Not-null-termainted string */ 75 + /* Not-null-terminated string */ 76 76 memcpy(skel->bss->str, skel->rodata->target, sizeof(skel->bss->str)); 77 77 skel->bss->str[sizeof(skel->bss->str) - 1] = 'A'; 78 78 got = trigger_strncmp(skel);
+2 -2
tools/testing/selftests/bpf/prog_tests/token.c
··· 867 867 } 868 868 unsetenv(TOKEN_ENVVAR); 869 869 870 - /* now the same struct_ops skeleton should succeed thanks to libppf 870 + /* now the same struct_ops skeleton should succeed thanks to libbpf 871 871 * creating BPF token from /sys/fs/bpf mount point 872 872 */ 873 873 skel = dummy_st_ops_success__open_and_load(); ··· 929 929 if (!ASSERT_OK(err, "setenv_token_path")) 930 930 goto err_out; 931 931 932 - /* now the same struct_ops skeleton should succeed thanks to libppf 932 + /* now the same struct_ops skeleton should succeed thanks to libbpf 933 933 * creating BPF token from custom mount point 934 934 */ 935 935 skel = dummy_st_ops_success__open_and_load();
+1 -1
tools/testing/selftests/bpf/prog_tests/uprobe_multi_test.c
··· 213 213 214 214 /* 215 215 * There are 2 entry and 2 exit probe called for each uprobe_multi_func_[123] 216 - * function and each slepable probe (6) increments uprobe_multi_sleep_result. 216 + * function and each sleepable probe (6) increments uprobe_multi_sleep_result. 217 217 */ 218 218 ASSERT_EQ(skel->bss->uprobe_multi_func_1_result, 2, "uprobe_multi_func_1_result"); 219 219 ASSERT_EQ(skel->bss->uprobe_multi_func_2_result, 2, "uprobe_multi_func_2_result");
+1 -1
tools/testing/selftests/bpf/prog_tests/user_ringbuf.c
··· 643 643 if (!ASSERT_EQ(err, 0, "deferred_kick_thread\n")) 644 644 goto cleanup; 645 645 646 - /* After spawning another thread that asychronously kicks the kernel to 646 + /* After spawning another thread that asynchronously kicks the kernel to 647 647 * drain the messages, we're able to block and successfully get a 648 648 * sample once we receive an event notification. 649 649 */
+3 -3
tools/testing/selftests/bpf/progs/bpf_cubic.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0-only 2 2 3 - /* WARNING: This implemenation is not necessarily the same 3 + /* WARNING: This implementation is not necessarily the same 4 4 * as the tcp_cubic.c. The purpose is mainly for testing 5 5 * the kernel BPF logic. 6 6 * ··· 314 314 * (so time^3 is done by using 64 bit) 315 315 * and without the support of division of 64bit numbers 316 316 * (so all divisions are done by using 32 bit) 317 - * also NOTE the unit of those veriables 317 + * also NOTE the unit of those variables 318 318 * time = (t - K) / 2^bictcp_HZ 319 319 * c = bic_scale >> 10 320 320 * rtt = (srtt >> 3) / HZ ··· 507 507 __u32 delay; 508 508 509 509 bpf_cubic_acked_called = 1; 510 - /* Some calls are for duplicates without timetamps */ 510 + /* Some calls are for duplicates without timestamps */ 511 511 if (sample->rtt_us < 0) 512 512 return; 513 513
+2 -2
tools/testing/selftests/bpf/progs/strobemeta.h
··· 373 373 len = bpf_probe_read_user_str(&data->payload[off], STROBE_MAX_STR_LEN, value->ptr); 374 374 /* 375 375 * if bpf_probe_read_user_str returns error (<0), due to casting to 376 - * unsinged int, it will become big number, so next check is 376 + * unsigned int, it will become big number, so next check is 377 377 * sufficient to check for errors AND prove to BPF verifier, that 378 378 * bpf_probe_read_user_str won't return anything bigger than 379 379 * STROBE_MAX_STR_LEN ··· 557 557 return NULL; 558 558 559 559 payload_off = ctx.payload_off; 560 - /* this should not really happen, here only to satisfy verifer */ 560 + /* this should not really happen, here only to satisfy verifier */ 561 561 if (payload_off > sizeof(data->payload)) 562 562 payload_off = sizeof(data->payload); 563 563 #else
+1 -1
tools/testing/selftests/bpf/progs/test_cls_redirect_dynptr.c
··· 503 503 * 504 504 * fill_tuple(&t, foo, sizeof(struct iphdr), 123, 321) 505 505 * 506 - * clang will substitue a costant for sizeof, which allows the verifier 506 + * clang will substitute a constant for sizeof, which allows the verifier 507 507 * to track it's value. Based on this, it can figure out the constant 508 508 * return value, and calling code works while still being "generic" to 509 509 * IPv4 and IPv6.
+1 -1
tools/testing/selftests/bpf/progs/test_core_read_macros.c
··· 36 36 return 0; 37 37 38 38 /* next pointers for kernel address space have to be initialized from 39 - * BPF side, user-space mmaped addresses are stil user-space addresses 39 + * BPF side, user-space mmaped addresses are still user-space addresses 40 40 */ 41 41 k_probe_in.next = &k_probe_in; 42 42 __builtin_preserve_access_index(({k_core_in.next = &k_core_in;}));
+1 -1
tools/testing/selftests/bpf/progs/test_global_func15.c
··· 44 44 * case we have a valid 1 stored in R0 register, but in 45 45 * a branch case we assign some random value to R0. So if 46 46 * there is something wrong with precision tracking for R0 at 47 - * program exit, we might erronenously prune branch case, 47 + * program exit, we might erroneously prune branch case, 48 48 * because R0 in fallthrough case is imprecise (and thus any 49 49 * value is valid from POV of verifier is_state_equal() logic) 50 50 */
+1 -1
tools/testing/selftests/bpf/progs/test_global_map_resize.c
··· 16 16 int sum = 0; 17 17 int array[1]; 18 18 19 - /* custom data secton */ 19 + /* custom data section */ 20 20 int my_array[1] SEC(".data.custom"); 21 21 22 22 /* custom data section which should NOT be resizable,
+1 -1
tools/testing/selftests/bpf/test_maps.c
··· 1515 1515 value == key); 1516 1516 } 1517 1517 1518 - /* Now let's delete all elemenets in parallel. */ 1518 + /* Now let's delete all elements in parallel. */ 1519 1519 data[1] = DO_DELETE; 1520 1520 run_parallel(TASKS, test_update_delete, data); 1521 1521
+1 -1
tools/testing/selftests/bpf/test_progs.c
··· 1500 1500 1501 1501 /* 1502 1502 * We only print error logs summary when there are failed tests and 1503 - * verbose mode is not enabled. Otherwise, results may be incosistent. 1503 + * verbose mode is not enabled. Otherwise, results may be inconsistent. 1504 1504 * 1505 1505 */ 1506 1506 if (!verbose() && fail_cnt) {
+1 -1
tools/testing/selftests/bpf/verifier/map_kptr.c
··· 153 153 .result = REJECT, 154 154 .errstr = "variable untrusted_ptr_ access var_off=(0x0; 0x7) disallowed", 155 155 }, 156 - /* Tests for unreferened PTR_TO_BTF_ID */ 156 + /* Tests for unreferenced PTR_TO_BTF_ID */ 157 157 { 158 158 "map_kptr: unref: reject btf_struct_ids_match == false", 159 159 .insns = {