提交 0901df3a 编写于 作者: D Daniel Borkmann 提交者: David S. Miller

bpf: use prefix_len in test_tag when reading fdinfo

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: 62b64660 ("bpf: add prog tag test case to bpf selftests")
Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
Acked-by: NAlexei Starovoitov <ast@kernel.org>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 1541f98c
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册