Skip to content
This repository has been archived by the owner on Jun 19, 2024. It is now read-only.

Commit

Permalink
BACKPORT: bpf: Use char in prog and map name
Browse files Browse the repository at this point in the history
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.

Change-Id: I599a8f1eccb0d63aa8d680b771fff1580c69cf75
Signed-off-by: Martin KaFai Lau <kafai@fb.com>
Cc: Jakub Kicinski <jakub.kicinski@netronome.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@fb.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
iamkafai authored and Royna2544 committed Apr 8, 2024
1 parent 329dda6 commit 29e4190
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions include/linux/bpf.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ struct bpf_map {
atomic_t refcnt;
atomic_t usercnt;
struct work_struct work;
u8 name[BPF_OBJ_NAME_LEN];
char name[BPF_OBJ_NAME_LEN];
};

/* function argument constraints */
Expand Down Expand Up @@ -205,7 +205,7 @@ struct bpf_prog_aux {
void *security;
#endif
u64 load_time; /* ns since boottime */
u8 name[BPF_OBJ_NAME_LEN];
char name[BPF_OBJ_NAME_LEN];
union {
struct work_struct work;
struct rcu_head rcu;
Expand Down
8 changes: 4 additions & 4 deletions include/uapi/linux/bpf.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ union bpf_attr {
__u32 numa_node; /* numa node (effective only if
* BPF_F_NUMA_NODE is set).
*/
__u8 map_name[BPF_OBJ_NAME_LEN];
char map_name[BPF_OBJ_NAME_LEN];
};

struct { /* anonymous struct used by BPF_MAP_*_ELEM commands */
Expand All @@ -218,7 +218,7 @@ union bpf_attr {
__aligned_u64 log_buf; /* user supplied buffer */
__u32 kern_version; /* checked when prog_type=kprobe */
__u32 prog_flags;
__u8 prog_name[BPF_OBJ_NAME_LEN];
char prog_name[BPF_OBJ_NAME_LEN];
};

struct { /* anonymous struct used by BPF_OBJ_* commands */
Expand Down Expand Up @@ -887,7 +887,7 @@ struct bpf_prog_info {
__u32 created_by_uid;
__u32 nr_map_ids;
__aligned_u64 map_ids;
__u8 name[BPF_OBJ_NAME_LEN];
char name[BPF_OBJ_NAME_LEN];
} __attribute__((aligned(8)));

struct bpf_map_info {
Expand All @@ -897,7 +897,7 @@ struct bpf_map_info {
__u32 value_size;
__u32 max_entries;
__u32 map_flags;
__u8 name[BPF_OBJ_NAME_LEN];
char name[BPF_OBJ_NAME_LEN];
} __attribute__((aligned(8)));

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

0 comments on commit 29e4190

Please sign in to comment.