Skip to content

Commit

Permalink
bpf: use prefix_len in test_tag when reading fdinfo
Browse files Browse the repository at this point in the history
We currently used len instead of prefix_len for the strncmp() in
fdinfo on the prog_tag. It still worked as we matched on the correct
output line also with first 8 instead of 10 chars, but lets fix it
properly to use the intended length.

Fixes: 62b6466 ("bpf: add prog tag test case to bpf selftests")
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Daniel Borkmann authored and David S. Miller committed Jan 26, 2017
1 parent 1541f98 commit 0901df3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tools/testing/selftests/bpf/test_tag.c
Original file line number Diff line number Diff line change
@@ -99,7 +99,7 @@ static void tag_from_fdinfo(int fd_prog, uint8_t *tag, uint32_t len)
assert(fp);

while (fgets(buff, sizeof(buff), fp)) {
if (strncmp(buff, "prog_tag:\t", len))
if (strncmp(buff, "prog_tag:\t", prefix_len))
continue;
ret = hex2bin(tag, buff + prefix_len, len);
break;

0 comments on commit 0901df3

Please sign in to comment.