Skip to content

Commit 38d976c

Browse files
T.J. MercierMartin KaFai Lau
T.J. Mercier
authored and
Martin KaFai Lau
committed
selftests/bpf: Fix kmem_cache iterator draining
The closing parentheses around the read syscall is misplaced, causing single byte reads from the iterator instead of buf sized reads. While the end result is the same, many more read calls than necessary are performed. $ tools/testing/selftests/bpf/vmtest.sh "./test_progs -t kmem_cache_iter" 145/1 kmem_cache_iter/check_task_struct:OK 145/2 kmem_cache_iter/check_slabinfo:OK 145/3 kmem_cache_iter/open_coded_iter:OK 145 kmem_cache_iter:OK Summary: 1/3 PASSED, 0 SKIPPED, 0 FAILED Fixes: a496d0c ("selftests/bpf: Add a test for kmem_cache_iter") Signed-off-by: T.J. Mercier <[email protected]> Signed-off-by: Martin KaFai Lau <[email protected]> Acked-by: Song Liu <[email protected]> Acked-by: Namhyung Kim <[email protected]> Link: https://patch.msgid.link/[email protected]
1 parent 8e64c38 commit 38d976c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tools/testing/selftests/bpf/prog_tests/kmem_cache_iter.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ void test_kmem_cache_iter(void)
104104
goto destroy;
105105

106106
memset(buf, 0, sizeof(buf));
107-
while (read(iter_fd, buf, sizeof(buf) > 0)) {
107+
while (read(iter_fd, buf, sizeof(buf)) > 0) {
108108
/* Read out all contents */
109109
printf("%s", buf);
110110
}

0 commit comments

Comments
 (0)