[PATCH bpf-next 1/3] bpf: Split btf_id/size union in struct bpf_func_proto

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When having helper that defines both arg*_btf_id and arg*_size fields,
one of those fields will end up with zero value.

With helper definition like:

  .arg1_type      = ARG_PTR_TO_BTF_ID,
  .arg1_btf_id    = &btf_tracing_ids[BTF_TRACING_TYPE_VMA],
  .arg2_type      = ARG_PTR_TO_FIXED_SIZE_MEM,
  .arg2_size      = BUILD_ID_SIZE_MAX,

The arg2_size field initializer zeros out the rest of the arg*_size
fields of its parent annon struct, so it effectively zeros also
arg1_btf_id field.

Moving arg*_btf_id and arg*_size fields into separate unions.

Signed-off-by: Jiri Olsa <jolsa@xxxxxxxxxx>
---
 include/linux/bpf.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/linux/bpf.h b/include/linux/bpf.h
index 798aec816970..21a1d42b5d4c 100644
--- a/include/linux/bpf.h
+++ b/include/linux/bpf.h
@@ -640,6 +640,8 @@ struct bpf_func_proto {
 			u32 *arg5_btf_id;
 		};
 		u32 *arg_btf_id[5];
+	};
+	union {
 		struct {
 			size_t arg1_size;
 			size_t arg2_size;
-- 
2.38.1




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux