aboutsummaryrefslogtreecommitdiffstats
path: root/tools/lib/bpf/libbpf.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/lib/bpf/libbpf.c')
-rw-r--r--tools/lib/bpf/libbpf.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index 955f8eafbf41..afa9860db755 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -1991,6 +1991,9 @@ int bpf_program__nth_fd(struct bpf_program *prog, int n)
1991{ 1991{
1992 int fd; 1992 int fd;
1993 1993
1994 if (!prog)
1995 return -EINVAL;
1996
1994 if (n >= prog->instances.nr || n < 0) { 1997 if (n >= prog->instances.nr || n < 0) {
1995 pr_warning("Can't get the %dth fd from program %s: only %d instances\n", 1998 pr_warning("Can't get the %dth fd from program %s: only %d instances\n",
1996 n, prog->section_name, prog->instances.nr); 1999 n, prog->section_name, prog->instances.nr);