[PATCH] kernel/bpf/syscall: use IS_FD_HASH in bpf_map_update_value
From: chensong_2000
Date: Thu Oct 09 2025 - 02:28:56 EST
From: Song Chen <chensong_2000@xxxxxx>
If IS_FD_HASH is defined on the top of the file, then use it to replace
"map->map_type == BPF_MAP_TYPE_HASH_OF_MAPS".
Signed-off-by: Song Chen <chensong_2000@xxxxxx>
---
kernel/bpf/syscall.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
index 0fbfa8532c39..2c194a73aeda 100644
--- a/kernel/bpf/syscall.c
+++ b/kernel/bpf/syscall.c
@@ -154,8 +154,7 @@ static void maybe_wait_bpf_programs(struct bpf_map *map)
* time can be very long and userspace may think it will hang forever,
* so don't handle sleepable BPF programs now.
*/
- if (map->map_type == BPF_MAP_TYPE_HASH_OF_MAPS ||
- map->map_type == BPF_MAP_TYPE_ARRAY_OF_MAPS)
+ if (IS_FD_HASH(map) || map->map_type == BPF_MAP_TYPE_ARRAY_OF_MAPS)
synchronize_rcu();
}
@@ -274,7 +273,7 @@ static int bpf_map_update_value(struct bpf_map *map, struct file *map_file,
} else if (IS_FD_ARRAY(map)) {
err = bpf_fd_array_map_update_elem(map, map_file, key, value,
flags);
- } else if (map->map_type == BPF_MAP_TYPE_HASH_OF_MAPS) {
+ } else if (IS_FD_HASH(map)) {
err = bpf_fd_htab_map_update_elem(map, map_file, key, value,
flags);
} else if (map->map_type == BPF_MAP_TYPE_REUSEPORT_SOCKARRAY) {
--
2.34.1