Re: [PATCH 1/2] [v2] bpf: hide unused bpf_patch_call_args

From: Yonghong Song
Date: Wed May 24 2023 - 14:13:20 EST




On 5/24/23 6:23 AM, Arnd Bergmann wrote:
On Wed, May 24, 2023, at 05:05, Yonghong Song wrote:
On 5/23/23 12:43 PM, Arnd Bergmann wrote:
From: Arnd Bergmann <arnd@xxxxxxxx>

This function has no callers and no declaration when CONFIG_BPF_JIT_ALWAYS_ON
is enabled:

kernel/bpf/core.c:2075:6: error: no previous prototype for 'bpf_patch_call_args' [-Werror=missing-prototypes]

If CONFIG_BPF_JIT_ALWAYS_ON is enabled, the definition of
bpf_patch_call_args should be invisible. Maybe I missed something.
Could you list *ALL& bpf related config options in your setup
so people can reproduce you above error messages?

Sorry, my mistake. I've reworded the changelog now to fix this:

| This function is only used when CONFIG_BPF_JIT_ALWAYS_ON is disabled,
| but CONFIG_BPF_SYSCALL is enabled. When both are turned off, the
| prototype is missing but the unused function is still compiled,
| as seen from this W=1 warning:
|
| kernel/bpf/core.c:2075:6: error: no previous prototype for 'bpf_patch_call_args' [-Werror=missing-prototypes]
|
| Add a matching #ifdef for the definition to leave it out.

If this makes sense now, I'll send out a v3.

Yes, the above new commit message sounds good to me. Thanks.


Arnd