[<prev] [next>] [day] [month] [year] [list]
Message-ID: <ae6bce75-d477-7727-316a-cb78e2cafc46@embeddedor.com>
Date: Mon, 30 Sep 2019 18:18:41 -0500
From: "Gustavo A. R. Silva" <gustavo@...eddedor.com>
To: Stephen Kitt <steve@....org>, Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Martin KaFai Lau <kafai@...com>,
Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>
Cc: linux-doc@...r.kernel.org, netdev@...r.kernel.org,
bpf@...r.kernel.org,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2] bpf: use flexible array members, not zero-length
On 9/30/19 02:38, Stephen Kitt wrote:
> This switches zero-length arrays in variable-length structs to C99
> flexible array members. GCC will then ensure that the arrays are
> always the last element in the struct.
>
> Coccinelle:
> @@
> identifier S, fld;
> type T;
> @@
>
> struct S {
> ...
> T fld[
> - 0
> ];
> ...
> };
>
> Signed-off-by: Stephen Kitt <steve@....org>
> ---
What changed in v2?
You should include a changelog here.
I encourage you to read the following document:
https://kernelnewbies.org/Outreachyfirstpatch
In particular this section "Versioning one patch revision"
Also, always CC the lkml: linux-kernel@...r.kernel.org
Thanks
--
Gustavo
> Documentation/bpf/btf.rst | 2 +-
> tools/lib/bpf/libbpf.c | 2 +-
> tools/lib/bpf/libbpf_internal.h | 2 +-
> 3 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/Documentation/bpf/btf.rst b/Documentation/bpf/btf.rst
> index 4d565d202ce3..24ce50fc1fc1 100644
> --- a/Documentation/bpf/btf.rst
> +++ b/Documentation/bpf/btf.rst
> @@ -670,7 +670,7 @@ func_info for each specific ELF section.::
> __u32 sec_name_off; /* offset to section name */
> __u32 num_info;
> /* Followed by num_info * record_size number of bytes */
> - __u8 data[0];
> + __u8 data[];
> };
>
> Here, num_info must be greater than 0.
> diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
> index e0276520171b..c02ea0e1a588 100644
> --- a/tools/lib/bpf/libbpf.c
> +++ b/tools/lib/bpf/libbpf.c
> @@ -5577,7 +5577,7 @@ static struct perf_buffer *__perf_buffer__new(int map_fd, size_t page_cnt,
> struct perf_sample_raw {
> struct perf_event_header header;
> uint32_t size;
> - char data[0];
> + char data[];
> };
>
> struct perf_sample_lost {
> diff --git a/tools/lib/bpf/libbpf_internal.h b/tools/lib/bpf/libbpf_internal.h
> index 2e83a34f8c79..930ada2276bf 100644
> --- a/tools/lib/bpf/libbpf_internal.h
> +++ b/tools/lib/bpf/libbpf_internal.h
> @@ -86,7 +86,7 @@ struct btf_ext_info_sec {
> __u32 sec_name_off;
> __u32 num_info;
> /* Followed by num_info * record_size number of bytes */
> - __u8 data[0];
> + __u8 data[];
> };
>
> /* The minimum bpf_func_info checked by the loader */
>
Powered by blists - more mailing lists