mirror of
https://github.com/torvalds/linux.git
synced 2024-11-29 23:51:37 +00:00
libbpf: Update API functions usage to check error
This updates usage of the following API functions within libbpf so their newly added error return is checked: - bpf_program__set_expected_attach_type() - bpf_program__set_type() Signed-off-by: Grant Seltzer <grantseltzer@gmail.com> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Link: https://lore.kernel.org/bpf/20220420161226.86803-2-grantseltzer@gmail.com
This commit is contained in:
parent
93442f132b
commit
df28671632
@ -7016,8 +7016,8 @@ static int bpf_object_init_progs(struct bpf_object *obj, const struct bpf_object
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
bpf_program__set_type(prog, prog->sec_def->prog_type);
|
prog->type = prog->sec_def->prog_type;
|
||||||
bpf_program__set_expected_attach_type(prog, prog->sec_def->expected_attach_type);
|
prog->expected_attach_type = prog->sec_def->expected_attach_type;
|
||||||
|
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||||
@ -8582,8 +8582,7 @@ int bpf_program__set_##NAME(struct bpf_program *prog) \
|
|||||||
{ \
|
{ \
|
||||||
if (!prog) \
|
if (!prog) \
|
||||||
return libbpf_err(-EINVAL); \
|
return libbpf_err(-EINVAL); \
|
||||||
bpf_program__set_type(prog, TYPE); \
|
return bpf_program__set_type(prog, TYPE); \
|
||||||
return 0; \
|
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
bool bpf_program__is_##NAME(const struct bpf_program *prog) \
|
bool bpf_program__is_##NAME(const struct bpf_program *prog) \
|
||||||
@ -9690,9 +9689,8 @@ static int bpf_prog_load_xattr2(const struct bpf_prog_load_attr *attr,
|
|||||||
* bpf_object__open guessed
|
* bpf_object__open guessed
|
||||||
*/
|
*/
|
||||||
if (attr->prog_type != BPF_PROG_TYPE_UNSPEC) {
|
if (attr->prog_type != BPF_PROG_TYPE_UNSPEC) {
|
||||||
bpf_program__set_type(prog, attr->prog_type);
|
prog->type = attr->prog_type;
|
||||||
bpf_program__set_expected_attach_type(prog,
|
prog->expected_attach_type = attach_type;
|
||||||
attach_type);
|
|
||||||
}
|
}
|
||||||
if (bpf_program__type(prog) == BPF_PROG_TYPE_UNSPEC) {
|
if (bpf_program__type(prog) == BPF_PROG_TYPE_UNSPEC) {
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user