]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
bpf: Use the IS_FD_ARRAY() macro in map_update_elem()
authorMickaël Salaün <mic@digikod.net>
Thu, 25 Jan 2018 23:54:02 +0000 (00:54 +0100)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 26 Jan 2018 02:05:24 +0000 (18:05 -0800)
Make the code more readable.

Signed-off-by: Mickaël Salaün <mic@digikod.net>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
kernel/bpf/syscall.c

index 5bdb0cc84ad24c1596506d1bb68f2e1cb05ed791..e24aa3241387de91483a89160e50ee41deede775 100644 (file)
@@ -709,10 +709,7 @@ static int map_update_elem(union bpf_attr *attr)
                err = bpf_percpu_hash_update(map, key, value, attr->flags);
        } else if (map->map_type == BPF_MAP_TYPE_PERCPU_ARRAY) {
                err = bpf_percpu_array_update(map, key, value, attr->flags);
-       } else if (map->map_type == BPF_MAP_TYPE_PERF_EVENT_ARRAY ||
-                  map->map_type == BPF_MAP_TYPE_PROG_ARRAY ||
-                  map->map_type == BPF_MAP_TYPE_CGROUP_ARRAY ||
-                  map->map_type == BPF_MAP_TYPE_ARRAY_OF_MAPS) {
+       } else if (IS_FD_ARRAY(map)) {
                rcu_read_lock();
                err = bpf_fd_array_map_update_elem(map, f.file, key, value,
                                                   attr->flags);