Skip to contentSkip to conversation

bpf: Fix an inconsitency between copies of bpf.h.

PATCH In review Kui-Feng Lee 2 participants 2 messages Aug 22, 2022 – Aug 23, 2022 BPF

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bpf: Fix an inconsitency between copies of bpf.h.

struct bpf_lpm_trie_key is inconsistent in two copies of bpf.h. It cuases a warning message during building the kernel.

---
 include/uapi/linux/bpf.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/uapi/linux/bpf.h +1 -1
index 934a2a8beb87..1d6085e15fc8 100644
@@ -79,7 +79,7 @@ struct bpf_insn {
 /* Key of an a BPF_MAP_TYPE_LPM_TRIE entry */
 struct bpf_lpm_trie_key {
 	__u32	prefixlen;	/* up to 32 for AF_INET, 128 for AF_INET6 */
-	__u8	data[];	/* Arbitrary size */
+	__u8	data[0];	/* Arbitrary size */
 };
 
 struct bpf_cgroup_storage_key {
Signature · 1 line
2.30.2
maintainer
#1 lore raw
Quoted 14 lines · Kui-Feng Lee

struct bpf_lpm_trie_key is inconsistent in two copies of bpf.h. It cuases a warning message during building the kernel.

---
  include/uapi/linux/bpf.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
include/uapi/linux/bpf.h +0 -0
index 934a2a8beb87..1d6085e15fc8 100644

include/uapi/linux/bpf.h struct bpf_insn { · line 85

Quoted 8 lines
include/uapi/linux/bpf.h +1 -1
@@ -79,7 +79,7 @@ struct bpf_insn {
  /* Key of an a BPF_MAP_TYPE_LPM_TRIE entry */
  struct bpf_lpm_trie_key {
  	__u32	prefixlen;	/* up to 32 for AF_INET, 128 for AF_INET6 */
-	__u8	data[];	/* Arbitrary size */
+	__u8	data[0];	/* Arbitrary size */
  };
 
  struct bpf_cgroup_storage_key {

This is fixed in bpf tree already, so it will propagate to bpf-next soon.

https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf.git/commit/?id=3024d95a4c521c278a7504ee9e80c57c3a9750e0

Thanks,
Daniel