Skip to content

Commit a1e83d4

Browse files
listoutAlexei Starovoitov
authored andcommitted
selftests/bpf: Fix redefinition of 'off' as different kind of symbol
This fixes the following build error CLNG-BPF [test_progs] verifier_global_ptr_args.bpf.o progs/verifier_global_ptr_args.c:228:5: error: redefinition of 'off' as different kind of symbol 228 | u32 off; | ^ The symbol 'off' was previously defined in tools/testing/selftests/bpf/tools/include/vmlinux.h, which includes an enum i40e_ptp_gpio_pin_state from drivers/net/ethernet/intel/i40e/i40e_ptp.c: enum i40e_ptp_gpio_pin_state { end = -2, invalid = -1, off = 0, in_A = 1, in_B = 2, out_A = 3, out_B = 4, }; This enum is included when CONFIG_I40E is enabled. As of commit 032676f ("LoongArch: Update Loongson-3 default config file"), CONFIG_I40E is set in the defconfig, which leads to the conflict. Renaming the local variable avoids the redefinition and allows the build to succeed. Suggested-by: Yonghong Song <[email protected]> Signed-off-by: Brahmajit Das <[email protected]> Acked-by: Yonghong Song <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexei Starovoitov <[email protected]>
1 parent 7c33e97 commit a1e83d4

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

tools/testing/selftests/bpf/progs/verifier_global_ptr_args.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ int trusted_to_untrusted(void *ctx)
225225
}
226226

227227
char mem[16];
228-
u32 off;
228+
u32 offset;
229229

230230
SEC("tp_btf/sys_enter")
231231
__success
@@ -240,9 +240,9 @@ int anything_to_untrusted(void *ctx)
240240
/* scalar to untrusted */
241241
subprog_untrusted(0);
242242
/* variable offset to untrusted (map) */
243-
subprog_untrusted((void *)mem + off);
243+
subprog_untrusted((void *)mem + offset);
244244
/* variable offset to untrusted (trusted) */
245-
subprog_untrusted((void *)bpf_get_current_task_btf() + off);
245+
subprog_untrusted((void *)bpf_get_current_task_btf() + offset);
246246
return 0;
247247
}
248248

@@ -298,12 +298,12 @@ int anything_to_untrusted_mem(void *ctx)
298298
/* scalar to untrusted mem */
299299
subprog_void_untrusted(0);
300300
/* variable offset to untrusted mem (map) */
301-
subprog_void_untrusted((void *)mem + off);
301+
subprog_void_untrusted((void *)mem + offset);
302302
/* variable offset to untrusted mem (trusted) */
303-
subprog_void_untrusted(bpf_get_current_task_btf() + off);
303+
subprog_void_untrusted(bpf_get_current_task_btf() + offset);
304304
/* variable offset to untrusted char/enum (map) */
305-
subprog_char_untrusted(mem + off);
306-
subprog_enum_untrusted((void *)mem + off);
305+
subprog_char_untrusted(mem + offset);
306+
subprog_enum_untrusted((void *)mem + offset);
307307
return 0;
308308
}
309309

0 commit comments

Comments
 (0)