Skip to content

Commit 0c7ae13

Browse files
pchaignoAlexei Starovoitov
authored andcommitted
tools/headers: Regenerate stddef.h to fix BPF selftests
With commit dacbfc1 ("crypto: af_alg - Annotate struct af_alg_iv with __counted_by"), two selftests, test_tag and crypto_sanity, now indirectly rely on the __counted_by macro. On systems with commit dacbfc1 in the installed UAPI headers, the selftests build fails with: In file included from tools/testing/selftests/bpf/prog_tests/crypto_sanity.c:7: /usr/include/linux/if_alg.h:45:22: error: expected ‘:’, ‘,’, ‘;’, ‘}’ or ‘__attribute__’ before ‘__counted_by’ 45 | __u8 iv[] __counted_by(ivlen); | ^~~~~~~~~~~~ This patch fixes it by regenerating stddef.h in tools/include using the instructions from commit a778f5d ("tools/headers: Pull in stddef.h to uapi to fix BPF selftests build in CI"). Fixes: dacbfc1 ("crypto: af_alg - Annotate struct af_alg_iv with __counted_by") Signed-off-by: Paul Chaignon <paul.chaignon@gmail.com> Reviewed-by: Alan Maguire <alan.maguire@oracle.com> Tested-by: Ihor Solodrai <ihor.solodrai@linux.dev> Link: https://lore.kernel.org/r/8da8ef16055aa452d940668ed5359ce54adc6b0b.1777715500.git.paul.chaignon@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
1 parent b5c111f commit 0c7ae13

1 file changed

Lines changed: 25 additions & 1 deletion

File tree

tools/include/uapi/linux/stddef.h

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#define _LINUX_STDDEF_H
44

55

6-
76
#ifndef __always_inline
87
#define __always_inline __inline__
98
#endif
@@ -36,6 +35,11 @@
3635
struct __struct_group_tag(TAG) { MEMBERS } ATTRS NAME; \
3736
} ATTRS
3837

38+
#ifdef __cplusplus
39+
/* sizeof(struct{}) is 1 in C++, not 0, can't use C version of the macro. */
40+
#define __DECLARE_FLEX_ARRAY(T, member) \
41+
T member[0]
42+
#else
3943
/**
4044
* __DECLARE_FLEX_ARRAY() - Declare a flexible array usable in a union
4145
*
@@ -52,3 +56,23 @@
5256
TYPE NAME[]; \
5357
}
5458
#endif
59+
60+
#ifndef __counted_by
61+
#define __counted_by(m)
62+
#endif
63+
64+
#ifndef __counted_by_le
65+
#define __counted_by_le(m)
66+
#endif
67+
68+
#ifndef __counted_by_be
69+
#define __counted_by_be(m)
70+
#endif
71+
72+
#ifndef __counted_by_ptr
73+
#define __counted_by_ptr(m)
74+
#endif
75+
76+
#define __kernel_nonstring
77+
78+
#endif /* _LINUX_STDDEF_H */

0 commit comments

Comments
 (0)