]> git.baikalelectronics.ru Git - kernel.git/commit
selftests/bpf: Fix issues in parse_num_list()
authorYuntao Wang <ytcoode@gmail.com>
Wed, 6 Apr 2022 00:36:22 +0000 (08:36 +0800)
committerAndrii Nakryiko <andrii@kernel.org>
Wed, 6 Apr 2022 17:10:03 +0000 (10:10 -0700)
commitd16bf6dfa4feafc62b637355454bcf23ae181a48
tree5aec89f5bfe8c861da3360b9353dede2a3e5cbc1
parent846ddbf606ac5cd92e67afed3c9ddc7a404fc79b
selftests/bpf: Fix issues in parse_num_list()

The function does not check that parsing_end is false after parsing
argument. Thus, if the final part of the argument is something like '4-',
which is invalid, parse_num_list() will discard it instead of returning
-EINVAL.

Before:

 $ ./test_progs -n 2,4-
 #2 atomic_bounds:OK
 Summary: 1/0 PASSED, 0 SKIPPED, 0 FAILED

After:

 $ ./test_progs -n 2,4-
 Failed to parse test numbers.

Signed-off-by: Yuntao Wang <ytcoode@gmail.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20220406003622.73539-1-ytcoode@gmail.com
tools/testing/selftests/bpf/testing_helpers.c