diff options
author | Anay Wadhera <awadhera@berkeley.edu> | 2021-05-20 22:00:16 -0700 |
---|---|---|
committer | Michael Bestas <mkbestas@lineageos.org> | 2022-04-19 00:49:50 +0300 |
commit | 923e1be9b3288e43396c75a982e6337ac9224c94 (patch) | |
tree | 9b8ce3e65ac3403f476c4182affedfb36bcbd1b2 /kernel/bpf/arraymap.c | |
parent | d84ee2be35554945b2a839f828ef55d7d9a0a694 (diff) |
Revert "bpf: fix allocation warnings in bpf maps and integer overflow"
This reverts commit 01b3f52157ff5a47d6d8d796f396a4b34a53c61d.
Signed-off-by: Chatur27 <jasonbright2709@gmail.com>
Diffstat (limited to 'kernel/bpf/arraymap.c')
-rw-r--r-- | kernel/bpf/arraymap.c | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/kernel/bpf/arraymap.c b/kernel/bpf/arraymap.c index b0799bced518..4c67ce39732e 100644 --- a/kernel/bpf/arraymap.c +++ b/kernel/bpf/arraymap.c @@ -28,17 +28,11 @@ static struct bpf_map *array_map_alloc(union bpf_attr *attr) attr->value_size == 0) return ERR_PTR(-EINVAL); - if (attr->value_size >= 1 << (KMALLOC_SHIFT_MAX - 1)) - /* if value_size is bigger, the user space won't be able to - * access the elements. - */ - return ERR_PTR(-E2BIG); - elem_size = round_up(attr->value_size, 8); /* check round_up into zero and u32 overflow */ if (elem_size == 0 || - attr->max_entries > (U32_MAX - PAGE_SIZE - sizeof(*array)) / elem_size) + attr->max_entries > (U32_MAX - sizeof(*array)) / elem_size) return ERR_PTR(-ENOMEM); array_size = sizeof(*array) + attr->max_entries * elem_size; |