]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
selftests/bpf: Fix typos and grammar in test sources
authorShubham Sharma <slopixelz@gmail.com>
Tue, 26 Aug 2025 12:57:46 +0000 (18:27 +0530)
committerAndrii Nakryiko <andrii@kernel.org>
Wed, 27 Aug 2025 22:13:08 +0000 (15:13 -0700)
Fix spelling typos and grammar errors in BPF selftests source code.

Signed-off-by: Shubham Sharma <slopixelz@gmail.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20250826125746.17983-1-slopixelz@gmail.com
28 files changed:
tools/testing/selftests/bpf/Makefile
tools/testing/selftests/bpf/bench.c
tools/testing/selftests/bpf/prog_tests/btf_dump.c
tools/testing/selftests/bpf/prog_tests/fd_array.c
tools/testing/selftests/bpf/prog_tests/kprobe_multi_test.c
tools/testing/selftests/bpf/prog_tests/module_attach.c
tools/testing/selftests/bpf/prog_tests/reg_bounds.c
tools/testing/selftests/bpf/prog_tests/stacktrace_build_id.c
tools/testing/selftests/bpf/prog_tests/stacktrace_build_id_nmi.c
tools/testing/selftests/bpf/prog_tests/stacktrace_map.c
tools/testing/selftests/bpf/prog_tests/stacktrace_map_raw_tp.c
tools/testing/selftests/bpf/prog_tests/stacktrace_map_skip.c
tools/testing/selftests/bpf/progs/bpf_cc_cubic.c
tools/testing/selftests/bpf/progs/bpf_dctcp.c
tools/testing/selftests/bpf/progs/freplace_connect_v4_prog.c
tools/testing/selftests/bpf/progs/iters_state_safety.c
tools/testing/selftests/bpf/progs/rbtree_search.c
tools/testing/selftests/bpf/progs/struct_ops_kptr_return.c
tools/testing/selftests/bpf/progs/struct_ops_refcounted.c
tools/testing/selftests/bpf/progs/test_cls_redirect.c
tools/testing/selftests/bpf/progs/test_cls_redirect_dynptr.c
tools/testing/selftests/bpf/progs/uretprobe_stack.c
tools/testing/selftests/bpf/progs/verifier_scalar_ids.c
tools/testing/selftests/bpf/progs/verifier_var_off.c
tools/testing/selftests/bpf/test_sockmap.c
tools/testing/selftests/bpf/verifier/calls.c
tools/testing/selftests/bpf/xdping.c
tools/testing/selftests/bpf/xsk.h

index 77794efc020ea65a87aceb50f55725a0f6283050..fd6b370c8169848d00552eb8a3c2a6a2daa24834 100644 (file)
@@ -398,7 +398,7 @@ $(HOST_BPFOBJ): $(wildcard $(BPFDIR)/*.[ch] $(BPFDIR)/Makefile)                    \
                    DESTDIR=$(HOST_SCRATCH_DIR)/ prefix= all install_headers
 endif
 
-# vmlinux.h is first dumped to a temprorary file and then compared to
+# vmlinux.h is first dumped to a temporary file and then compared to
 # the previous version. This helps to avoid unnecessary re-builds of
 # $(TRUNNER_BPF_OBJS)
 $(INCLUDE_DIR)/vmlinux.h: $(VMLINUX_BTF) $(BPFTOOL) | $(INCLUDE_DIR)
index ddd73d06a1eb27bedb748f89c91c568596f70e4c..3ecc226ea7b25d1be45ffb7f02baf5cc48cc3ee5 100644 (file)
@@ -499,7 +499,7 @@ extern const struct bench bench_rename_rawtp;
 extern const struct bench bench_rename_fentry;
 extern const struct bench bench_rename_fexit;
 
-/* pure counting benchmarks to establish theoretical lmits */
+/* pure counting benchmarks to establish theoretical limits */
 extern const struct bench bench_trig_usermode_count;
 extern const struct bench bench_trig_syscall_count;
 extern const struct bench bench_trig_kernel_count;
index 82903585c8700ce0619c18801220389eadd02669..10cba526d3e631b8ac1a810eb5682f1ea2346348 100644 (file)
@@ -63,7 +63,7 @@ static int test_btf_dump_case(int n, struct btf_dump_test_case *t)
 
        /* tests with t->known_ptr_sz have no "long" or "unsigned long" type,
         * so it's impossible to determine correct pointer size; but if they
-        * do, it should be 8 regardless of host architecture, becaues BPF
+        * do, it should be 8 regardless of host architecture, because BPF
         * target is always 64-bit
         */
        if (!t->known_ptr_sz) {
index 241b2c8c6e0f152bbc24e67094320cefb3b32474..c534b4d5f9da80e9b3a4b109f2c8fb581cca1db5 100644 (file)
@@ -293,7 +293,7 @@ static int get_btf_id_by_fd(int btf_fd, __u32 *id)
  *  1) Create a new btf, it's referenced only by a file descriptor, so refcnt=1
  *  2) Load a BPF prog with fd_array[0] = btf_fd; now btf's refcnt=2
  *  3) Close the btf_fd, now refcnt=1
- * Wait and check that BTF stil exists.
+ * Wait and check that BTF still exists.
  */
 static void check_fd_array_cnt__referenced_btfs(void)
 {
index e19ef509ebf85eecca4a614f4fcb99f745035015..f377bea0b82d4fd808f8d541031897bf1e1395a8 100644 (file)
@@ -463,7 +463,7 @@ static bool skip_entry(char *name)
        return false;
 }
 
-/* Do comparision by ignoring '.llvm.<hash>' suffixes. */
+/* Do comparison by ignoring '.llvm.<hash>' suffixes. */
 static int compare_name(const char *name1, const char *name2)
 {
        const char *res1, *res2;
index 6d391d95f96e0041088f62a53ba90a618ce21230..70fa7ae93173b64da2f8afd073d502103e40f0ad 100644 (file)
@@ -90,7 +90,7 @@ void test_module_attach(void)
 
        test_module_attach__detach(skel);
 
-       /* attach fentry/fexit and make sure it get's module reference */
+       /* attach fentry/fexit and make sure it gets module reference */
        link = bpf_program__attach(skel->progs.handle_fentry);
        if (!ASSERT_OK_PTR(link, "attach_fentry"))
                goto cleanup;
index e261b0e872dbbaecface5583fb68901e8c323077..d93a0c7b1786f13f9eb398e77040683985a4641c 100644 (file)
@@ -623,7 +623,7 @@ static void range_cond(enum num_t t, struct range x, struct range y,
                        *newx = range(t, x.a, x.b);
                        *newy = range(t, y.a + 1, y.b);
                } else if (x.a == x.b && x.b == y.b) {
-                       /* X is a constant matching rigth side of Y */
+                       /* X is a constant matching right side of Y */
                        *newx = range(t, x.a, x.b);
                        *newy = range(t, y.a, y.b - 1);
                } else if (y.a == y.b && x.a == y.a) {
@@ -631,7 +631,7 @@ static void range_cond(enum num_t t, struct range x, struct range y,
                        *newx = range(t, x.a + 1, x.b);
                        *newy = range(t, y.a, y.b);
                } else if (y.a == y.b && x.b == y.b) {
-                       /* Y is a constant matching rigth side of X */
+                       /* Y is a constant matching right side of X */
                        *newx = range(t, x.a, x.b - 1);
                        *newy = range(t, y.a, y.b);
                } else {
index b7ba5cd47d96fa37b71a5c23c6e837d0624ae5d6..271b5cc9fc01532c4c70f57c5705e5f15b518750 100644 (file)
@@ -39,7 +39,7 @@ retry:
        bpf_map_update_elem(control_map_fd, &key, &val, 0);
 
        /* for every element in stackid_hmap, we can find a corresponding one
-        * in stackmap, and vise versa.
+        * in stackmap, and vice versa.
         */
        err = compare_map_keys(stackid_hmap_fd, stackmap_fd);
        if (CHECK(err, "compare_map_keys stackid_hmap vs. stackmap",
index 0832fd7874575cb57fec52a8e266101b022823d4..b277dddd5af7ffd7b3648008638bcdb87d94f1bc 100644 (file)
@@ -66,7 +66,7 @@ retry:
        bpf_map_update_elem(control_map_fd, &key, &val, 0);
 
        /* for every element in stackid_hmap, we can find a corresponding one
-        * in stackmap, and vise versa.
+        * in stackmap, and vice versa.
         */
        err = compare_map_keys(stackid_hmap_fd, stackmap_fd);
        if (CHECK(err, "compare_map_keys stackid_hmap vs. stackmap",
index df59e4ae29510087eff80f85b2aa8d343d0fd0b1..84a7e405e9129d643c36a58fc6ba73a4685f06bb 100644 (file)
@@ -50,7 +50,7 @@ void test_stacktrace_map(void)
        bpf_map_update_elem(control_map_fd, &key, &val, 0);
 
        /* for every element in stackid_hmap, we can find a corresponding one
-        * in stackmap, and vise versa.
+        * in stackmap, and vice versa.
         */
        err = compare_map_keys(stackid_hmap_fd, stackmap_fd);
        if (CHECK(err, "compare_map_keys stackid_hmap vs. stackmap",
index c6ef06f55cdb46be5d8c1b953329372b3f9bc5d0..e0cb4697b4b3ccd411be9a975ef12283641f0107 100644 (file)
@@ -46,7 +46,7 @@ void test_stacktrace_map_raw_tp(void)
        bpf_map_update_elem(control_map_fd, &key, &val, 0);
 
        /* for every element in stackid_hmap, we can find a corresponding one
-        * in stackmap, and vise versa.
+        * in stackmap, and vice versa.
         */
        err = compare_map_keys(stackid_hmap_fd, stackmap_fd);
        if (CHECK(err, "compare_map_keys stackid_hmap vs. stackmap",
index 1932b1e0685cfdaa6f82da5e65275d39c35f5b14..dc2ccf6a14d13318216c3640b38e039bc331c9d0 100644 (file)
@@ -40,7 +40,7 @@ void test_stacktrace_map_skip(void)
        skel->bss->control = 1;
 
        /* for every element in stackid_hmap, we can find a corresponding one
-        * in stackmap, and vise versa.
+        * in stackmap, and vice versa.
         */
        err = compare_map_keys(stackid_hmap_fd, stackmap_fd);
        if (!ASSERT_OK(err, "compare_map_keys stackid_hmap vs. stackmap"))
index 1654a530aa3dc63b79b62e92f98a298b5a5a4728..4e51785e7606e72949ca5f81e15772d8efc8040b 100644 (file)
@@ -101,7 +101,7 @@ static void tcp_cwnd_reduction(struct sock *sk, int newly_acked_sacked,
        tp->snd_cwnd = pkts_in_flight + sndcnt;
 }
 
-/* Decide wheather to run the increase function of congestion control. */
+/* Decide whether to run the increase function of congestion control. */
 static bool tcp_may_raise_cwnd(const struct sock *sk, const int flag)
 {
        if (tcp_sk(sk)->reordering > TCP_REORDERING)
index 7cd73e75f52a2b1464342dd27e7f9f7811d8542d..32c511bcd60b3a96a977a3dbd481eafed8d74202 100644 (file)
@@ -1,7 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0
 /* Copyright (c) 2019 Facebook */
 
-/* WARNING: This implemenation is not necessarily the same
+/* WARNING: This implementation is not necessarily the same
  * as the tcp_dctcp.c.  The purpose is mainly for testing
  * the kernel BPF logic.
  */
index 544e5ac9046106f256b58f36e86b18e231aaf70b..d09bbd8ae8a85b1c953ebd3fe94ab93d92c29b31 100644 (file)
@@ -12,7 +12,7 @@
 SEC("freplace/connect_v4_prog")
 int new_connect_v4_prog(struct bpf_sock_addr *ctx)
 {
-       // return value thats in invalid range
+       // return value that's in invalid range
        return 255;
 }
 
index f41257eadbb258cd4c26fa03b1834353536f7e04..b381ac0c736cf0a47cc74d40ec1f9a462cbf4cff 100644 (file)
@@ -345,7 +345,7 @@ int __naked read_from_iter_slot_fail(void)
                "r3 = 1000;"
                "call %[bpf_iter_num_new];"
 
-               /* attemp to leak bpf_iter_num state */
+               /* attempt to leak bpf_iter_num state */
                "r7 = *(u64 *)(r6 + 0);"
                "r8 = *(u64 *)(r6 + 8);"
 
index 098ef970fac1607f295a409420582d8ea9f1395d..b05565d1db0d478fa7954a8d7905adc7f967997c 100644 (file)
@@ -183,7 +183,7 @@ long test_##op##_spinlock_##dolock(void *ctx)               \
 }
 
 /*
- * Use a spearate MSG macro instead of passing to TEST_XXX(..., MSG)
+ * Use a separate MSG macro instead of passing to TEST_XXX(..., MSG)
  * to ensure the message itself is not in the bpf prog lineinfo
  * which the verifier includes in its log.
  * Otherwise, the test_loader will incorrectly match the prog lineinfo
index 36386b3c23a1f6bf4949714f4585a4ae3d2724d0..2b98b7710816dce7dd26198d2dcf719e2e0612ca 100644 (file)
@@ -9,7 +9,7 @@ void bpf_task_release(struct task_struct *p) __ksym;
 
 /* This test struct_ops BPF programs returning referenced kptr. The verifier should
  * allow a referenced kptr or a NULL pointer to be returned. A referenced kptr to task
- * here is acquried automatically as the task argument is tagged with "__ref".
+ * here is acquired automatically as the task argument is tagged with "__ref".
  */
 SEC("struct_ops/test_return_ref_kptr")
 struct task_struct *BPF_PROG(kptr_return, int dummy,
index 76dcb6089d7f8e37de76aae48f1ed7d30279c97a..9c0a65466356c969b9f293e108fc195ecf8fdaa7 100644 (file)
@@ -9,7 +9,7 @@ __attribute__((nomerge)) extern void bpf_task_release(struct task_struct *p) __k
 
 /* This is a test BPF program that uses struct_ops to access a referenced
  * kptr argument. This is a test for the verifier to ensure that it
- * 1) recongnizes the task as a referenced object (i.e., ref_obj_id > 0), and
+ * 1) recognizes the task as a referenced object (i.e., ref_obj_id > 0), and
  * 2) the same reference can be acquired from multiple paths as long as it
  *    has not been released.
  */
index f344c6835e84e7991c97bb6bb28366e33394f2b4..823169fb6e4c7f2d55522e5e12945122aa6ea4cc 100644 (file)
@@ -129,7 +129,7 @@ typedef uint8_t *net_ptr __attribute__((align_value(8)));
 typedef struct buf {
        struct __sk_buff *skb;
        net_ptr head;
-       /* NB: tail musn't have alignment other than 1, otherwise
+       /* NB: tail mustn't have alignment other than 1, otherwise
        * LLVM will go and eliminate code, e.g. when checking packet lengths.
        */
        uint8_t *const tail;
index d0f7670351e587c2995d90972f1c2dcb19af2f50..dfd4a2710391d94875321deec8170941740bc08a 100644 (file)
@@ -494,7 +494,7 @@ static ret_t get_next_hop(struct bpf_dynptr *dynptr, __u64 *offset, encap_header
 
        *offset += sizeof(*next_hop);
 
-       /* Skip the remainig next hops (may be zero). */
+       /* Skip the remaining next hops (may be zero). */
        return skip_next_hops(offset, encap->unigue.hop_count - encap->unigue.next_hop - 1);
 }
 
index 9fdcf396b8f467e5a9267a93bad019ce74f1d9da..a2951e2f1711b8fdfd629e11f4c6802f394fede3 100644 (file)
@@ -26,8 +26,8 @@ int usdt_len;
 SEC("uprobe//proc/self/exe:target_1")
 int BPF_UPROBE(uprobe_1)
 {
-       /* target_1 is recursive wit depth of 2, so we capture two separate
-        * stack traces, depending on which occurence it is
+       /* target_1 is recursive with depth of 2, so we capture two separate
+        * stack traces, depending on which occurrence it is
         */
        static bool recur = false;
 
index 7c5e5e6d10ebc2387a69ba01a3d34a35ca7a824f..dba3ca728f6e6f48e17940ec47e20cd4bfa211b2 100644 (file)
@@ -349,7 +349,7 @@ __naked void precision_two_ids(void)
 SEC("socket")
 __success __log_level(2)
 __flag(BPF_F_TEST_STATE_FREQ)
-/* check thar r0 and r6 have different IDs after 'if',
+/* check that r0 and r6 have different IDs after 'if',
  * collect_linked_regs() can't tie more than 6 registers for a single insn.
  */
 __msg("8: (25) if r0 > 0x7 goto pc+0         ; R0=scalar(id=1")
index 1d36d01b746e78d1895db3a6f96a99314051d1a3..f345466bca6868b052546163a14f9749aa7f7337 100644 (file)
@@ -114,8 +114,8 @@ __naked void stack_write_priv_vs_unpriv(void)
 }
 
 /* Similar to the previous test, but this time also perform a read from the
- * address written to with a variable offset. The read is allowed, showing that,
- * after a variable-offset write, a priviledged program can read the slots that
+ * address written to with a variable offet. The read is allowed, showing that,
+ * after a variable-offset write, a privileged program can read the slots that
  * were in the range of that write (even if the verifier doesn't actually know if
  * the slot being read was really written to or not.
  *
@@ -157,7 +157,7 @@ __naked void stack_write_followed_by_read(void)
 SEC("socket")
 __description("variable-offset stack write clobbers spilled regs")
 __failure
-/* In the priviledged case, dereferencing a spilled-and-then-filled
+/* In the privileged case, dereferencing a spilled-and-then-filled
  * register is rejected because the previous variable offset stack
  * write might have overwritten the spilled pointer (i.e. we lose track
  * of the spilled register when we analyze the write).
index fd2da2234cc9b44342352bc7b0417be1cbecc747..76568db7a66422c2211aa6b1eaf71670141879a5 100644 (file)
@@ -1372,7 +1372,7 @@ run:
        } else
                fprintf(stderr, "unknown test\n");
 out:
-       /* Detatch and zero all the maps */
+       /* Detach and zero all the maps */
        bpf_prog_detach2(bpf_program__fd(progs[3]), cg_fd, BPF_CGROUP_SOCK_OPS);
 
        for (i = 0; i < ARRAY_SIZE(links); i++) {
index f3492efc88346ecb6f08289769fb4f7ad5a131ef..c8d640802cce415da9cba2c78c13720decab64f3 100644 (file)
        BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0, 1),
        /* write into map value */
        BPF_ST_MEM(BPF_DW, BPF_REG_0, 0, 0),
-       /* fetch secound map_value_ptr from the stack */
+       /* fetch second map_value_ptr from the stack */
        BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_10, -16),
        BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0, 1),
        /* write into map value */
        /* second time with fp-16 */
        BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 1, 0, 4),
        BPF_JMP_IMM(BPF_JNE, BPF_REG_0, 1, 2),
-       /* fetch secound map_value_ptr from the stack */
+       /* fetch second map_value_ptr from the stack */
        BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_7, 0),
        /* write into map value */
        BPF_ST_MEM(BPF_DW, BPF_REG_0, 0, 0),
        /* second time with fp-16 */
        BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 1, 0, 4),
        BPF_JMP_IMM(BPF_JNE, BPF_REG_0, 0, 2),
-       /* fetch secound map_value_ptr from the stack */
+       /* fetch second map_value_ptr from the stack */
        BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_7, 0),
        /* write into map value */
        BPF_ST_MEM(BPF_DW, BPF_REG_0, 0, 0),
         */
        BPF_JMP_REG(BPF_JGT, BPF_REG_6, BPF_REG_7, 1),
        BPF_MOV64_REG(BPF_REG_9, BPF_REG_8),
-       /* r9 = *r9                ; verifier get's to this point via two paths:
+       /* r9 = *r9                ; verifier gets to this point via two paths:
         *                         ; (I) one including r9 = r8, verified first;
         *                         ; (II) one excluding r9 = r8, verified next.
         *                         ; After load of *r9 to r9 the frame[0].fp[-24].id == r9.id.
index 1503a1d2faa090e13c88bb7cec2fc9d44226b2c6..9ed8c796645d001a96118c1d8f524359b13c3f59 100644 (file)
@@ -155,7 +155,7 @@ int main(int argc, char **argv)
        }
 
        if (!server) {
-               /* Only supports IPv4; see hints initiailization above. */
+               /* Only supports IPv4; see hints initialization above. */
                if (getaddrinfo(argv[optind], NULL, &hints, &a) || !a) {
                        fprintf(stderr, "Could not resolve %s\n", argv[optind]);
                        return 1;
index 93c2cc413cfcd03369ac98852c0393d4c66d4f07..48729da142c249af4e30b3153e1520e06a20f751 100644 (file)
@@ -93,8 +93,8 @@ static inline __u32 xsk_prod_nb_free(struct xsk_ring_prod *r, __u32 nb)
        /* Refresh the local tail pointer.
         * cached_cons is r->size bigger than the real consumer pointer so
         * that this addition can be avoided in the more frequently
-        * executed code that computs free_entries in the beginning of
-        * this function. Without this optimization it whould have been
+        * executed code that computes free_entries in the beginning of
+        * this function. Without this optimization it would have been
         * free_entries = r->cached_prod - r->cached_cons + r->size.
         */
        r->cached_cons = __atomic_load_n(r->consumer, __ATOMIC_ACQUIRE);