summaryrefslogtreecommitdiff
path: root/kernel/bpf/stackmap.c
diff options
context:
space:
mode:
authorTony Lindgren <tony@atomide.com>2021-02-15 06:41:56 +0200
committerTony Lindgren <tony@atomide.com>2021-02-15 06:41:56 +0200
commit857de6fe2f86b009df620f7cdb07c262cc17070d (patch)
treee9718ebeeef39485a51a9f8e3c8122da18c796cf /kernel/bpf/stackmap.c
parent9bbce32a20d6a72c767a7f85fd6127babd1410ac (diff)
parentfbfa463be8dc7957ee4f81556e9e1ea2a951807d (diff)
Merge branch 'fixes-v5.11' into fixes
Diffstat (limited to 'kernel/bpf/stackmap.c')
-rw-r--r--kernel/bpf/stackmap.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/kernel/bpf/stackmap.c b/kernel/bpf/stackmap.c
index aea96b638473..bfafbf115bf3 100644
--- a/kernel/bpf/stackmap.c
+++ b/kernel/bpf/stackmap.c
@@ -115,6 +115,8 @@ static struct bpf_map *stack_map_alloc(union bpf_attr *attr)
/* hash table size must be power of 2 */
n_buckets = roundup_pow_of_two(attr->max_entries);
+ if (!n_buckets)
+ return ERR_PTR(-E2BIG);
cost = n_buckets * sizeof(struct stack_map_bucket *) + sizeof(*smap);
cost += n_buckets * (value_size + sizeof(struct stack_map_bucket));