提交 cf9d0140 编写于 作者: J John Fastabend 提交者: David S. Miller

bpf: devmap: remove unnecessary value size check

In the devmap alloc map logic we check to ensure that the sizeof the
values are not greater than KMALLOC_MAX_SIZE. But, in the dev map case
we ensure the value size is 4bytes earlier in the function because all
values should be netdev ifindex values.

The second check is harmless but is not needed so remove it.
Signed-off-by: NJohn Fastabend <john.fastabend@gmail.com>
Acked-by: NDaniel Borkmann <daniel@iogearbox.net>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 ef70f9a2
...@@ -83,12 +83,6 @@ static struct bpf_map *dev_map_alloc(union bpf_attr *attr) ...@@ -83,12 +83,6 @@ static struct bpf_map *dev_map_alloc(union bpf_attr *attr)
attr->value_size != 4 || attr->map_flags) attr->value_size != 4 || attr->map_flags)
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
/* if value_size is bigger, the user space won't be able to
* access the elements.
*/
if (attr->value_size > KMALLOC_MAX_SIZE)
return ERR_PTR(-E2BIG);
dtab = kzalloc(sizeof(*dtab), GFP_USER); dtab = kzalloc(sizeof(*dtab), GFP_USER);
if (!dtab) if (!dtab)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册