bpf: Use bpf_map_area_alloc consistently on bpf map creation
[linux-2.6-microblaze.git] / kernel / bpf / ringbuf.c
index df8062c..b483aea 100644 (file)
@@ -164,7 +164,7 @@ static struct bpf_map *ringbuf_map_alloc(union bpf_attr *attr)
                return ERR_PTR(-E2BIG);
 #endif
 
-       rb_map = kzalloc(sizeof(*rb_map), GFP_USER | __GFP_NOWARN | __GFP_ACCOUNT);
+       rb_map = bpf_map_area_alloc(sizeof(*rb_map), NUMA_NO_NODE);
        if (!rb_map)
                return ERR_PTR(-ENOMEM);
 
@@ -172,7 +172,7 @@ static struct bpf_map *ringbuf_map_alloc(union bpf_attr *attr)
 
        rb_map->rb = bpf_ringbuf_alloc(attr->max_entries, rb_map->map.numa_node);
        if (!rb_map->rb) {
-               kfree(rb_map);
+               bpf_map_area_free(rb_map);
                return ERR_PTR(-ENOMEM);
        }
 
@@ -199,7 +199,7 @@ static void ringbuf_map_free(struct bpf_map *map)
 
        rb_map = container_of(map, struct bpf_ringbuf_map, map);
        bpf_ringbuf_free(rb_map->rb);
-       kfree(rb_map);
+       bpf_map_area_free(rb_map);
 }
 
 static void *ringbuf_map_lookup_elem(struct bpf_map *map, void *key)