From: John Fastabend <john.fastabend@gmail.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, john.fastabend@gmail.com
Subject: [net-next PATCH] bpf: devmap: remove unnecessary value size check
Date: Tue, 15 Aug 2017 23:35:12 -0700 [thread overview]
Message-ID: <20170816063512.14925.40390.stgit@john-Precision-Tower-5810> (raw)
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);
next reply other threads:[~2017-08-16 6:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-16 6:35 John Fastabend [this message]
2017-08-16 8:39 ` [net-next PATCH] bpf: devmap: remove unnecessary value size check Daniel Borkmann
2017-08-16 18:35 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170816063512.14925.40390.stgit@john-Precision-Tower-5810 \
--to=john.fastabend@gmail.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox