From: Jakub Kicinski <kuba@kernel.org>
To: Song Liu <song@kernel.org>
Cc: <bpf@vger.kernel.org>, <netdev@vger.kernel.org>, <ast@kernel.org>,
<daniel@iogearbox.net>, <andrii@kernel.org>, <kernel-team@fb.com>,
<sfr@canb.auug.org.au>
Subject: Re: [PATCH bpf-next] bpf: fix bpf_prog_pack build for ppc64_defconfig
Date: Fri, 11 Feb 2022 15:54:56 -0800 [thread overview]
Message-ID: <20220211155456.0195575a@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> (raw)
In-Reply-To: <20220211014915.2403508-1-song@kernel.org>
On Thu, 10 Feb 2022 17:49:15 -0800 Song Liu wrote:
> bpf_prog_pack causes build error with powerpc ppc64_defconfig:
>
> kernel/bpf/core.c:830:23: error: variably modified 'bitmap' at file scope
> 830 | unsigned long bitmap[BITS_TO_LONGS(BPF_PROG_CHUNK_COUNT)];
> | ^~~~~~
No idea what this error means but...
> Fix it by turning bitmap into a 0-length array.
>
> Fixes: 57631054fae6 ("bpf: Introduce bpf_prog_pack allocator")
> Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
> Signed-off-by: Song Liu <song@kernel.org>
> ---
> kernel/bpf/core.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c
> index 42d96549a804..44623c9b5bb1 100644
> --- a/kernel/bpf/core.c
> +++ b/kernel/bpf/core.c
> @@ -827,7 +827,7 @@ int bpf_jit_add_poke_descriptor(struct bpf_prog *prog,
> struct bpf_prog_pack {
> struct list_head list;
> void *ptr;
> - unsigned long bitmap[BITS_TO_LONGS(BPF_PROG_CHUNK_COUNT)];
> + unsigned long bitmap[];
This is really asking to be DECLARE_BITMAP(), does that fix the issue?
> };
>
> #define BPF_PROG_MAX_PACK_PROG_SIZE BPF_PROG_PACK_SIZE
> @@ -840,7 +840,7 @@ static struct bpf_prog_pack *alloc_new_pack(void)
> {
> struct bpf_prog_pack *pack;
>
> - pack = kzalloc(sizeof(*pack), GFP_KERNEL);
> + pack = kzalloc(sizeof(*pack) + BITS_TO_BYTES(BPF_PROG_CHUNK_COUNT), GFP_KERNEL);
Otherwise you may want to use struct_size(pack, bitmap, BITS...).
One of the bots will soon send us a patch to do that.
> if (!pack)
> return NULL;
> pack->ptr = module_alloc(BPF_PROG_PACK_SIZE);
next prev parent reply other threads:[~2022-02-11 23:55 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-11 1:49 [PATCH bpf-next] bpf: fix bpf_prog_pack build for ppc64_defconfig Song Liu
2022-02-11 23:54 ` Jakub Kicinski [this message]
2022-02-12 1:23 ` Song Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220211155456.0195575a@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com \
--to=kuba@kernel.org \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=kernel-team@fb.com \
--cc=netdev@vger.kernel.org \
--cc=sfr@canb.auug.org.au \
--cc=song@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.