Skip to contentSkip to conversation

bpf: Remove redundant assignment to smap->map.value_size

PATCH Applied Yuntao Wang 3 participants 3 messages Mar 23, 2022 – Apr 1, 2022

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bpf: Remove redundant assignment to smap->map.value_size

The attr->value_size is already assigned to smap->map.value_size in bpf_map_init_from_attr(), there is no need to do it again in stack_map_alloc()

---
 kernel/bpf/stackmap.c | 1 -
 1 file changed, 1 deletion(-)
kernel/bpf/stackmap.c +0 -1
index 34725bfa1e97..6131b4a19572 100644
@@ -106,7 +106,6 @@ static struct bpf_map *stack_map_alloc(union bpf_attr *attr)
 		return ERR_PTR(-ENOMEM);
 
 	bpf_map_init_from_attr(&smap->map, attr);
-	smap->map.value_size = value_size;
 	smap->n_buckets = n_buckets;
 
 	err = get_callchain_buffers(sysctl_perf_event_max_stack);
Signature · 1 line
2.35.0.rc2
Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Yuntao Wang

The attr->value_size is already assigned to smap->map.value_size in bpf_map_init_from_attr(), there is no need to do it again in stack_map_alloc()

LGTM.

Quoted 19 lines
---
 kernel/bpf/stackmap.c | 1 -
 1 file changed, 1 deletion(-)
kernel/bpf/stackmap.c +0 -2
index 34725bfa1e97..6131b4a19572 100644
@@ -106,7 +106,6 @@ static struct bpf_map *stack_map_alloc(union bpf_attr *attr)
                return ERR_PTR(-ENOMEM);
 
        bpf_map_init_from_attr(&smap->map, attr);
-       smap->map.value_size = value_size;
        smap->n_buckets = n_buckets;
 
        err = get_callchain_buffers(sysctl_perf_event_max_stack);
--

2.35.0.rc2

#2 lore raw
In reply to Yuntao Wang
This patch was applied to bpf/bpf-next.git (master) by Daniel Borkmann <[email protected]>:

Hello:

This patch was applied to bpf/bpf-next.git (master) by Daniel Borkmann <[email protected]>:

Quoted 8 lines · On Wed, 23 Mar 2022 15:36:26 +0800 you wrote:

The attr->value_size is already assigned to smap->map.value_size in bpf_map_init_from_attr(), there is no need to do it again in stack_map_alloc()

---
 kernel/bpf/stackmap.c | 1 -
 1 file changed, 1 deletion(-)

Here is the summary with links:
- [bpf-next] bpf: Remove redundant assignment to smap->map.value_size

    https://git.kernel.org/bpf/bpf-next/c/8eb943fc5e5f

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html