From: Dan Carpenter Date: Fri, 13 Jul 2018 15:05:37 +0000 (+0300) Subject: samples/bpf: test_cgrp2_sock2: fix an off by one X-Git-Tag: v5.15~8230^2~306^2~6 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ee583014a9d8cc48cb4969f87cc02c12b966fabc;p=platform%2Fkernel%2Flinux-starfive.git samples/bpf: test_cgrp2_sock2: fix an off by one "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 Reviewed-by: David Ahern Signed-off-by: Alexei Starovoitov --- diff --git a/samples/bpf/test_cgrp2_sock2.c b/samples/bpf/test_cgrp2_sock2.c index 3b5be23..a9277b1 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; }