From: Daniel Borkmann Date: Wed, 25 Jan 2017 23:42:49 +0000 (+0100) Subject: bpf: use prefix_len in test_tag when reading fdinfo X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=0901df3aeaee6cb5dde2fd51089786aff6225ebf;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git 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 Acked-by: Alexei Starovoitov Signed-off-by: David S. Miller --- diff --git a/tools/testing/selftests/bpf/test_tag.c b/tools/testing/selftests/bpf/test_tag.c index 6ab4793b3d16..5f7c602f47d1 100644 --- a/tools/testing/selftests/bpf/test_tag.c +++ b/tools/testing/selftests/bpf/test_tag.c @@ -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;