Skip to contentSkip to conversation

libbpf: Fix lookup_and_delete_elem_flags

PATCH Applied Mehrdad Arshad Rad 3 participants 3 messages Nov 4, 2021 – Nov 5, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libbpf: Fix lookup_and_delete_elem_flags

Added libbpf_err_errno to bpf_map_lookup_and_delete_elem_flags

---
 tools/lib/bpf/bpf.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
tools/lib/bpf/bpf.c +3 -1
index c09cbb868c9f..725701235fd8 100644
@@ -515,6 +515,7 @@ int bpf_map_lookup_and_delete_elem(int fd, const void *key, void *value)
 int bpf_map_lookup_and_delete_elem_flags(int fd, const void *key, void *value, __u64 flags)
 {
 	union bpf_attr attr;
+	int ret;
 
 	memset(&attr, 0, sizeof(attr));
 	attr.map_fd = fd;
@@ -522,7 +523,8 @@ int bpf_map_lookup_and_delete_elem_flags(int fd, const void *key, void *value, _
 	attr.value = ptr_to_u64(value);
 	attr.flags = flags;
 
-	return sys_bpf(BPF_MAP_LOOKUP_AND_DELETE_ELEM, &attr, sizeof(attr));
+	ret = sys_bpf(BPF_MAP_LOOKUP_AND_DELETE_ELEM, &attr, sizeof(attr));
+	return libbpf_err_errno(ret);
 }
 
 int bpf_map_delete_elem(int fd, const void *key)
Signature · 1 line
2.25.1
#2 lore raw
In reply to Mehrdad Arshad Rad
This patch was applied to bpf/bpf.git (master) by Daniel Borkmann <[email protected]>:

Hello:

This patch was applied to bpf/bpf.git (master)
by Daniel Borkmann <[email protected]>:

Quoted 6 lines · On Thu, 4 Nov 2021 10:13:54 -0700 you wrote:

Added libbpf_err_errno to bpf_map_lookup_and_delete_elem_flags

---
 tools/lib/bpf/bpf.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Here is the summary with links:
- libbpf: Fix lookup_and_delete_elem_flags

    https://git.kernel.org/bpf/bpf/c/64165ddf8ea1

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html