* [net-next PATCH] bpf: devmap: remove unnecessary value size check
@ 2017-08-16 6:35 John Fastabend
2017-08-16 8:39 ` Daniel Borkmann
2017-08-16 18:35 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: John Fastabend @ 2017-08-16 6:35 UTC (permalink / raw)
To: davem; +Cc: netdev, john.fastabend
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: John Fastabend <john.fastabend@gmail.com>
---
kernel/bpf/devmap.c | 6 ------
1 file changed, 6 deletions(-)
diff --git a/kernel/bpf/devmap.c b/kernel/bpf/devmap.c
index 7192fb6..18a72a8 100644
--- a/kernel/bpf/devmap.c
+++ b/kernel/bpf/devmap.c
@@ -83,12 +83,6 @@ static struct bpf_map *dev_map_alloc(union bpf_attr *attr)
attr->value_size != 4 || attr->map_flags)
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);
if (!dtab)
return ERR_PTR(-ENOMEM);
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-08-16 18:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-16 6:35 [net-next PATCH] bpf: devmap: remove unnecessary value size check John Fastabend
2017-08-16 8:39 ` Daniel Borkmann
2017-08-16 18:35 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).