Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Dan Carpenter and committed by
Alexei Starovoitov
ee583014 b0294bc1

+1 -1
+1 -1
samples/bpf/test_cgrp2_sock2.c
··· 51 51 if (argc > 3) 52 52 filter_id = atoi(argv[3]); 53 53 54 - if (filter_id > prog_cnt) { 54 + if (filter_id >= prog_cnt) { 55 55 printf("Invalid program id; program not found in file\n"); 56 56 return EXIT_FAILURE; 57 57 }