Skip to content

Commit cf9d014

Browse files
jrfastabdavem330
authored andcommitted
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: John Fastabend <[email protected]> Acked-by: Daniel Borkmann <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent ef70f9a commit cf9d014

File tree

1 file changed

+0
-6
lines changed

1 file changed

+0
-6
lines changed

kernel/bpf/devmap.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,6 @@ static struct bpf_map *dev_map_alloc(union bpf_attr *attr)
8383
attr->value_size != 4 || attr->map_flags)
8484
return ERR_PTR(-EINVAL);
8585

86-
/* if value_size is bigger, the user space won't be able to
87-
* access the elements.
88-
*/
89-
if (attr->value_size > KMALLOC_MAX_SIZE)
90-
return ERR_PTR(-E2BIG);
91-
9286
dtab = kzalloc(sizeof(*dtab), GFP_USER);
9387
if (!dtab)
9488
return ERR_PTR(-ENOMEM);

0 commit comments

Comments
 (0)