Skip to content

Commit 067cae4

Browse files
iamkafaidavem330
authored andcommitted
bpf: Use char in prog and map name
Instead of u8, use char for prog and map name. It can avoid the userspace tool getting compiler's signess warning. The bpf_prog_aux, bpf_map, bpf_attr, bpf_prog_info and bpf_map_info are changed. Signed-off-by: Martin KaFai Lau <[email protected]> Cc: Jakub Kicinski <[email protected]> Acked-by: Daniel Borkmann <[email protected]> Acked-by: Alexei Starovoitov <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 473d973 commit 067cae4

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

include/linux/bpf.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ struct bpf_map {
5656
struct work_struct work;
5757
atomic_t usercnt;
5858
struct bpf_map *inner_map_meta;
59-
u8 name[BPF_OBJ_NAME_LEN];
59+
char name[BPF_OBJ_NAME_LEN];
6060
};
6161

6262
/* function argument constraints */
@@ -189,7 +189,7 @@ struct bpf_prog_aux {
189189
struct bpf_prog *prog;
190190
struct user_struct *user;
191191
u64 load_time; /* ns since boottime */
192-
u8 name[BPF_OBJ_NAME_LEN];
192+
char name[BPF_OBJ_NAME_LEN];
193193
union {
194194
struct work_struct work;
195195
struct rcu_head rcu;

include/uapi/linux/bpf.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ union bpf_attr {
230230
__u32 numa_node; /* numa node (effective only if
231231
* BPF_F_NUMA_NODE is set).
232232
*/
233-
__u8 map_name[BPF_OBJ_NAME_LEN];
233+
char map_name[BPF_OBJ_NAME_LEN];
234234
};
235235

236236
struct { /* anonymous struct used by BPF_MAP_*_ELEM commands */
@@ -253,7 +253,7 @@ union bpf_attr {
253253
__aligned_u64 log_buf; /* user supplied buffer */
254254
__u32 kern_version; /* checked when prog_type=kprobe */
255255
__u32 prog_flags;
256-
__u8 prog_name[BPF_OBJ_NAME_LEN];
256+
char prog_name[BPF_OBJ_NAME_LEN];
257257
};
258258

259259
struct { /* anonymous struct used by BPF_OBJ_* commands */
@@ -888,7 +888,7 @@ struct bpf_prog_info {
888888
__u32 created_by_uid;
889889
__u32 nr_map_ids;
890890
__aligned_u64 map_ids;
891-
__u8 name[BPF_OBJ_NAME_LEN];
891+
char name[BPF_OBJ_NAME_LEN];
892892
} __attribute__((aligned(8)));
893893

894894
struct bpf_map_info {
@@ -898,7 +898,7 @@ struct bpf_map_info {
898898
__u32 value_size;
899899
__u32 max_entries;
900900
__u32 map_flags;
901-
__u8 name[BPF_OBJ_NAME_LEN];
901+
char name[BPF_OBJ_NAME_LEN];
902902
} __attribute__((aligned(8)));
903903

904904
/* User bpf_sock_ops struct to access socket values and specify request ops

tools/include/uapi/linux/bpf.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ union bpf_attr {
230230
__u32 numa_node; /* numa node (effective only if
231231
* BPF_F_NUMA_NODE is set).
232232
*/
233-
__u8 map_name[BPF_OBJ_NAME_LEN];
233+
char map_name[BPF_OBJ_NAME_LEN];
234234
};
235235

236236
struct { /* anonymous struct used by BPF_MAP_*_ELEM commands */
@@ -253,7 +253,7 @@ union bpf_attr {
253253
__aligned_u64 log_buf; /* user supplied buffer */
254254
__u32 kern_version; /* checked when prog_type=kprobe */
255255
__u32 prog_flags;
256-
__u8 prog_name[BPF_OBJ_NAME_LEN];
256+
char prog_name[BPF_OBJ_NAME_LEN];
257257
};
258258

259259
struct { /* anonymous struct used by BPF_OBJ_* commands */
@@ -871,7 +871,7 @@ struct bpf_prog_info {
871871
__u32 created_by_uid;
872872
__u32 nr_map_ids;
873873
__aligned_u64 map_ids;
874-
__u8 name[BPF_OBJ_NAME_LEN];
874+
char name[BPF_OBJ_NAME_LEN];
875875
} __attribute__((aligned(8)));
876876

877877
struct bpf_map_info {
@@ -881,7 +881,7 @@ struct bpf_map_info {
881881
__u32 value_size;
882882
__u32 max_entries;
883883
__u32 map_flags;
884-
__u8 name[BPF_OBJ_NAME_LEN];
884+
char name[BPF_OBJ_NAME_LEN];
885885
} __attribute__((aligned(8)));
886886

887887
/* User bpf_sock_ops struct to access socket values and specify request ops

0 commit comments

Comments
 (0)