mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-11 08:18:47 +00:00
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: 62b64660262a ("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>
This commit is contained in:
parent
1541f98cc2
commit
0901df3aea
@ -99,7 +99,7 @@ static void tag_from_fdinfo(int fd_prog, uint8_t *tag, uint32_t len)
|
|||||||
assert(fp);
|
assert(fp);
|
||||||
|
|
||||||
while (fgets(buff, sizeof(buff), fp)) {
|
while (fgets(buff, sizeof(buff), fp)) {
|
||||||
if (strncmp(buff, "prog_tag:\t", len))
|
if (strncmp(buff, "prog_tag:\t", prefix_len))
|
||||||
continue;
|
continue;
|
||||||
ret = hex2bin(tag, buff + prefix_len, len);
|
ret = hex2bin(tag, buff + prefix_len, len);
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user