summaryrefslogtreecommitdiffstats
path: root/samples
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2018-07-13 17:05:37 +0200
committerAlexei Starovoitov <ast@kernel.org>2018-07-17 00:01:09 +0200
commitee583014a9d8cc48cb4969f87cc02c12b966fabc (patch)
treedb0f40dd24b7a57cd486299c186f7bee0915318f /samples
parentsamples: bpf: ensure that we don't load over MAX_PROGS programs (diff)
downloadlinux-ee583014a9d8cc48cb4969f87cc02c12b966fabc.tar.xz
linux-ee583014a9d8cc48cb4969f87cc02c12b966fabc.zip
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 <dan.carpenter@oracle.com> Reviewed-by: David Ahern <dsahern@gmail.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'samples')
-rw-r--r--samples/bpf/test_cgrp2_sock2.c2
1 files changed, 1 insertions, 1 deletions
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;
}