* [PATCH 2/2] samples/bpf: test_cgrp2_sock2: fix an off by one
@ 2018-07-13 15:05 Dan Carpenter
2018-07-13 15:17 ` David Ahern
2018-07-16 22:07 ` Alexei Starovoitov
0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2018-07-13 15:05 UTC (permalink / raw)
To: Alexei Starovoitov; +Cc: Daniel Borkmann, netdev, kernel-janitors
"prog_cnt" is the number of elements which are filled out in prog_fd[]
so the test should be >= instead of >.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/samples/bpf/test_cgrp2_sock2.c b/samples/bpf/test_cgrp2_sock2.c
index 3b5be2364975..a9277b118c33 100644
--- a/samples/bpf/test_cgrp2_sock2.c
+++ b/samples/bpf/test_cgrp2_sock2.c
@@ -51,7 +51,7 @@ int main(int argc, char **argv)
if (argc > 3)
filter_id = atoi(argv[3]);
- if (filter_id > prog_cnt) {
+ if (filter_id >= prog_cnt) {
printf("Invalid program id; program not found in file\n");
return EXIT_FAILURE;
}
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH 2/2] samples/bpf: test_cgrp2_sock2: fix an off by one
2018-07-13 15:05 [PATCH 2/2] samples/bpf: test_cgrp2_sock2: fix an off by one Dan Carpenter
@ 2018-07-13 15:17 ` David Ahern
2018-07-16 22:07 ` Alexei Starovoitov
1 sibling, 0 replies; 3+ messages in thread
From: David Ahern @ 2018-07-13 15:17 UTC (permalink / raw)
To: Dan Carpenter, Alexei Starovoitov
Cc: Daniel Borkmann, netdev, kernel-janitors
On 7/13/18 11:05 AM, Dan Carpenter wrote:
> "prog_cnt" is the number of elements which are filled out in prog_fd[]
> so the test should be >= instead of >.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
Fixes: 554ae6e792ef3 ("samples/bpf: add userspace example for
prohibiting sockets")
Reviewed-by: David Ahern <dsahern@gmail.com>
Thanks for the fix.
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH 2/2] samples/bpf: test_cgrp2_sock2: fix an off by one
2018-07-13 15:05 [PATCH 2/2] samples/bpf: test_cgrp2_sock2: fix an off by one Dan Carpenter
2018-07-13 15:17 ` David Ahern
@ 2018-07-16 22:07 ` Alexei Starovoitov
1 sibling, 0 replies; 3+ messages in thread
From: Alexei Starovoitov @ 2018-07-16 22:07 UTC (permalink / raw)
To: Dan Carpenter
Cc: Alexei Starovoitov, Daniel Borkmann, netdev, kernel-janitors
On Fri, Jul 13, 2018 at 06:05:37PM +0300, Dan Carpenter wrote:
> "prog_cnt" is the number of elements which are filled out in prog_fd[]
> so the test should be >= instead of >.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
since this is sample code I've applied both patches to bpf-next tree.
Thanks
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-07-16 22:36 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-13 15:05 [PATCH 2/2] samples/bpf: test_cgrp2_sock2: fix an off by one Dan Carpenter
2018-07-13 15:17 ` David Ahern
2018-07-16 22:07 ` Alexei Starovoitov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox