selftests/bpf: remove unused duration variable
Subsystems (3)
PATCH 1/1 selftests/bpf: remove unused duration variable
From: Palak Raval <[email protected]>
The duration variable in cgroup_attach_override.c is not referenced anywhere in the file.
Remove the unused variable.
--- tools/testing/selftests/bpf/prog_tests/cgroup_attach_override.c | 1 - 1 file changed, 1 deletion(-)
tools/testing/selftests/bpf/prog_tests/cgroup_attach_override.c +0 -1
@@ -26,7 +26,6 @@ static int prog_load(int verdict)void serial_test_cgroup_attach_override (void ) {int drop_prog =-1 , allow_prog =-1 , foo =-1 , bar =-1 ; -__u32 duration =0 ; allow_prog =prog_load (1 ); if (CHECK(allow_prog < 0, "prog_load_allow",
Signature · 1 line
2.43.0
[email protected]
AI reviewThank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Low] selftests/bpf: build failure from removing duration variable used by CHECK macro --
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] selftests/bpf: build failure from removing duration variable used by CHECK macro --
commit 554358d3f4b47b8628cdfddabbecc7bb2c5d4380
Author: Palak Raval <[email protected]>
selftests/bpf: remove unused duration variable
This commit removes the local duration variable from cgroup_attach_override.c, stating that it is not referenced anywhere in the file.
Quoted 11 lines
tools/testing/selftests/bpf/prog_tests/cgroup_attach_override.c +0
-1@@ -26,7 +26,6 @@ static int prog_load(int verdict)void serial_test_cgroup_attach_override (void ) {int drop_prog =-1 , allow_prog =-1 , foo =-1 , bar =-1 ; -__u32 duration =0 ; allow_prog =prog_load (1 ); if (CHECK(allow_prog < 0, "prog_load_allow",
Quoted 1 line
"verifier output:\n%s\n-------\n",
bpf_log_buf))
[Severity: Low]
Will this code continue to compile after removing the duration variable?
In BPF selftests, the legacy CHECK macro implicitly references a variable named duration from the caller's scope to track test execution time. Removing it here in serial_test_cgroup_attach_override() leaves the duration symbol undeclared, which will cause the build to fail when the CHECK macro expands immediately after this change.
Would it be better to migrate these checks to modern macros like ASSERT_OK() first, so the duration variable can then be safely removed?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1