From: Roman Gushchin bpf_map__attach_struct_ops() returns -EINVAL instead of -ENOMEM on the memory allocation failure. Fix it. Fixes: 590a00888250 ("bpf: libbpf: Add STRUCT_OPS support") Signed-off-by: Roman Gushchin Acked-by: Yafang Shao Signed-off-by: Ben Gardon --- Split out from the BPF OOM series as a standalone fix. v3: https://lore.kernel.org/all/20260127024421.494929-4-roman.gushchin@linux.dev/ tools/lib/bpf/libbpf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c index fb8a1f07c5b6..e47544c4a0d2 100644 --- a/tools/lib/bpf/libbpf.c +++ b/tools/lib/bpf/libbpf.c @@ -14724,7 +14724,7 @@ struct bpf_link *bpf_map__attach_struct_ops(const struct bpf_map *map) link = calloc(1, sizeof(*link)); if (!link) - return libbpf_err_ptr(-EINVAL); + return libbpf_err_ptr(-ENOMEM); /* kern_vdata should be prepared during the loading phase. */ err = bpf_map_update_elem(map->fd, &zero, map->st_ops->kern_vdata, 0); -- 2.56.1.911.g883d8bcb20-goog