All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] bpf: use prefix_len in test_tag when reading fdinfo
@ 2017-01-25 23:42 Daniel Borkmann
  2017-01-26  4:15 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Daniel Borkmann @ 2017-01-25 23:42 UTC (permalink / raw)
  To: davem; +Cc: ast, netdev, Daniel Borkmann

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>
---
 tools/testing/selftests/bpf/test_tag.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/bpf/test_tag.c b/tools/testing/selftests/bpf/test_tag.c
index 6ab4793..5f7c602 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;
-- 
1.9.3

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net-next] bpf: use prefix_len in test_tag when reading fdinfo
  2017-01-25 23:42 [PATCH net-next] bpf: use prefix_len in test_tag when reading fdinfo Daniel Borkmann
@ 2017-01-26  4:15 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2017-01-26  4:15 UTC (permalink / raw)
  To: daniel; +Cc: ast, netdev

From: Daniel Borkmann <daniel@iogearbox.net>
Date: Thu, 26 Jan 2017 00:42:49 +0100

> 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>

Applied.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-01-26  4:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-25 23:42 [PATCH net-next] bpf: use prefix_len in test_tag when reading fdinfo Daniel Borkmann
2017-01-26  4:15 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.