From 923e1be9b3288e43396c75a982e6337ac9224c94 Mon Sep 17 00:00:00 2001 From: Anay Wadhera Date: Thu, 20 May 2021 22:00:16 -0700 Subject: Revert "bpf: fix allocation warnings in bpf maps and integer overflow" This reverts commit 01b3f52157ff5a47d6d8d796f396a4b34a53c61d. Signed-off-by: Chatur27 --- kernel/bpf/arraymap.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'kernel/bpf/arraymap.c') 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; -- cgit v1.2.3