diff options
| author | Eduard Zingerman <eddyz87@gmail.com> | 2024-08-20 03:23:50 -0700 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2024-10-04 16:33:24 +0200 |
| commit | 4c3ce023e538ca2267465c80e8491bf75a9121ee (patch) | |
| tree | f33eacd5ad6319c891be887c0d7be456c4cb2f93 /tools | |
| parent | bd93fe03abbe071fe00b86a5bddaa71d3adcc266 (diff) | |
| download | linux-4c3ce023e538ca2267465c80e8491bf75a9121ee.tar.gz linux-4c3ce023e538ca2267465c80e8491bf75a9121ee.tar.bz2 linux-4c3ce023e538ca2267465c80e8491bf75a9121ee.zip | |
selftests/bpf: correctly move 'log' upon successful match
commit d0a29cdb6ef95d8a175e09ab2d1334271f047e60 upstream.
Suppose log="foo bar buz" and msg->substr="bar".
In such case current match processing logic would update 'log' as
follows: log += strlen(msg->substr); -> log += 3 -> log=" bar".
However, the intent behind the 'log' update is to make it point after
the successful match, e.g. to make log=" buz" in the example above.
Fixes: 4ef5d6af4935 ("selftests/bpf: no need to track next_match_pos in struct test_loader")
Signed-off-by: Eduard Zingerman <eddyz87@gmail.com>
Link: https://lore.kernel.org/r/20240820102357.3372779-3-eddyz87@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/testing/selftests/bpf/test_loader.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/testing/selftests/bpf/test_loader.c b/tools/testing/selftests/bpf/test_loader.c index 0f59bc33a666..2150e9c9b53f 100644 --- a/tools/testing/selftests/bpf/test_loader.c +++ b/tools/testing/selftests/bpf/test_loader.c @@ -545,7 +545,7 @@ static void validate_msgs(char *log_buf, struct expected_msgs *msgs, if (msg->substr) { match = strstr(log, msg->substr); if (match) - log += strlen(msg->substr); + log = match + strlen(msg->substr); } else { err = regexec(&msg->regex, log, 1, reg_match, 0); if (err == 0) { |
