netdevsim: avoid allocation warnings triggered from user space
Subsystems (4)
Jakub Kicinski
maintainerPATCH 1/1 netdevsim: avoid allocation warnings triggered from user space
We need to suppress warnings from sily map sizes. Also switch from GFP_USER to GFP_KERNEL_ACCOUNT, I'm pretty sure I misunderstood the flags when writing this code.
Fixes 395cacb5f1a0 ("netdevsim: bpf: support fake map offload")
Reported-by [email protected]
Signed-off-by Jakub Kicinski <[email protected]>
--- drivers/net/netdevsim/bpf.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/net/netdevsim/bpf.c +5 -3
@@ -351,10 +351,12 @@ nsim_map_alloc_elem(struct bpf_offloaded_map *offmap, unsigned int idx) {struct nsim_bpf_bound_map *nmap = offmap->dev_priv; - nmap->entry[idx].key =kmalloc (offmap->map.key_size,GFP_USER ); + nmap->entry[idx].key =kmalloc (offmap->map.key_size, +GFP_KERNEL_ACCOUNT | __GFP_NOWARN);if (!nmap->entry[idx].key)return -ENOMEM ; - nmap->entry[idx].value =kmalloc (offmap->map.value_size,GFP_USER ); + nmap->entry[idx].value =kmalloc (offmap->map.value_size, +GFP_KERNEL_ACCOUNT | __GFP_NOWARN);if (!nmap->entry[idx].value) {kfree (nmap->entry[idx].key); nmap->entry[idx].key =NULL ;
@@ -496,7 +498,7 @@ nsim_bpf_map_alloc(struct netdevsim *ns, struct bpf_offloaded_map *offmap)if (offmap->map.map_flags)return -EINVAL ; - nmap =kzalloc (sizeof (*nmap),GFP_USER ); + nmap =kzalloc (sizeof (*nmap),GFP_KERNEL_ACCOUNT );if (!nmap)return -ENOMEM ;
Signature · 1 line
2.37.1
This patch was applied to bpf/bpf-next.git (master) by Andrii Nakryiko <[email protected]>:
Hello:
This patch was applied to bpf/bpf-next.git (master) by Andrii Nakryiko <[email protected]>:
Quoted 9 lines · On Tue, 26 Jul 2022 14:36:05 -0700 you wrote:
We need to suppress warnings from sily map sizes. Also switch from
GFP_USERtoGFP_KERNEL_ACCOUNT, I'm pretty sure I misunderstood the flags when writing this code.Fixes 395cacb5f1a0 ("netdevsim: bpf: support fake map offload")Reported-by [email protected]Signed-off-by Jakub Kicinski <[email protected]>[...]
Here is the summary with links:
- [bpf] netdevsim: avoid allocation warnings triggered from user space
https://git.kernel.org/bpf/bpf-next/c/d0b80a9edb1a
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html