bpf, samples: don't zero data when not needed
Remove the zero initialization in the sample programs where appropriate. Note that this is an optimization which is now possible, old programs still doing the zero initialization are just fine as well. Also, make sure we don't have padding issues when we don't memset() the entire struct anymore. Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Alexei Starovoitov <ast@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
074f528eed
commit
02413cabd6
@@ -66,7 +66,7 @@ struct hist_key {
|
||||
char comm[16];
|
||||
u64 pid_tgid;
|
||||
u64 uid_gid;
|
||||
u32 index;
|
||||
u64 index;
|
||||
};
|
||||
|
||||
struct bpf_map_def SEC("maps") my_hist_map = {
|
||||
@@ -82,7 +82,7 @@ int bpf_prog3(struct pt_regs *ctx)
|
||||
long write_size = PT_REGS_PARM3(ctx);
|
||||
long init_val = 1;
|
||||
long *value;
|
||||
struct hist_key key = {};
|
||||
struct hist_key key;
|
||||
|
||||
key.index = log2l(write_size);
|
||||
key.pid_tgid = bpf_get_current_pid_tgid();
|
||||
|
Reference in New Issue
Block a user