* [PATCH bpf-next] bpf, arm64: Remove unused-but-set function and variable.
@ 2025-05-28 0:27 Alexei Starovoitov
2025-05-28 2:28 ` Xu Kuohai
2025-05-28 3:20 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Alexei Starovoitov @ 2025-05-28 0:27 UTC (permalink / raw)
To: bpf; +Cc: daniel, andrii, martin.lau, xukuohai, alexis.lothore, kernel-team
From: Alexei Starovoitov <ast@kernel.org>
Remove unused-but-set function and variable to fix the build warning:
arch/arm64/net/bpf_jit_comp.c: In function 'arch_bpf_trampoline_size':
>> arch/arm64/net/bpf_jit_comp.c:2547:6: warning: variable 'nregs' set but not used [-Wunused-but-set-variable]
2547 | int nregs, ret;
| ^~~~~
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202505280643.h0qYcSCM-lkp@intel.com/
Fixes: 9014cf56f13d ("bpf, arm64: Support up to 12 function arguments")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
---
arch/arm64/net/bpf_jit_comp.c | 21 ++-------------------
1 file changed, 2 insertions(+), 19 deletions(-)
diff --git a/arch/arm64/net/bpf_jit_comp.c b/arch/arm64/net/bpf_jit_comp.c
index b5c3ab623536..14d4c6ac4ca0 100644
--- a/arch/arm64/net/bpf_jit_comp.c
+++ b/arch/arm64/net/bpf_jit_comp.c
@@ -2520,21 +2520,6 @@ static int prepare_trampoline(struct jit_ctx *ctx, struct bpf_tramp_image *im,
return ctx->idx;
}
-static int btf_func_model_nregs(const struct btf_func_model *m)
-{
- int nregs = m->nr_args;
- int i;
-
- /* extra registers needed for struct argument */
- for (i = 0; i < MAX_BPF_FUNC_ARGS; i++) {
- /* The arg_size is at most 16 bytes, enforced by the verifier. */
- if (m->arg_flags[i] & BTF_FMODEL_STRUCT_ARG)
- nregs += (m->arg_size[i] + 7) / 8 - 1;
- }
-
- return nregs;
-}
-
int arch_bpf_trampoline_size(const struct btf_func_model *m, u32 flags,
struct bpf_tramp_links *tlinks, void *func_addr)
{
@@ -2543,10 +2528,8 @@ int arch_bpf_trampoline_size(const struct btf_func_model *m, u32 flags,
.idx = 0,
};
struct bpf_tramp_image im;
- struct arg_aux aaux;
- int nregs, ret;
-
- nregs = btf_func_model_nregs(m);
+ struct arg_aux aaux;
+ int ret;
ret = calc_arg_aux(m, &aaux);
if (ret < 0)
--
2.47.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH bpf-next] bpf, arm64: Remove unused-but-set function and variable.
2025-05-28 0:27 [PATCH bpf-next] bpf, arm64: Remove unused-but-set function and variable Alexei Starovoitov
@ 2025-05-28 2:28 ` Xu Kuohai
2025-05-28 3:20 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Xu Kuohai @ 2025-05-28 2:28 UTC (permalink / raw)
To: Alexei Starovoitov, bpf
Cc: daniel, andrii, martin.lau, alexis.lothore, kernel-team
On 5/28/2025 8:27 AM, Alexei Starovoitov wrote:
> From: Alexei Starovoitov <ast@kernel.org>
>
> Remove unused-but-set function and variable to fix the build warning:
> arch/arm64/net/bpf_jit_comp.c: In function 'arch_bpf_trampoline_size':
>>> arch/arm64/net/bpf_jit_comp.c:2547:6: warning: variable 'nregs' set but not used [-Wunused-but-set-variable]
> 2547 | int nregs, ret;
> | ^~~~~
>
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202505280643.h0qYcSCM-lkp@intel.com/
> Fixes: 9014cf56f13d ("bpf, arm64: Support up to 12 function arguments")
> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
> ---
> arch/arm64/net/bpf_jit_comp.c | 21 ++-------------------
> 1 file changed, 2 insertions(+), 19 deletions(-)
>
> diff --git a/arch/arm64/net/bpf_jit_comp.c b/arch/arm64/net/bpf_jit_comp.c
> index b5c3ab623536..14d4c6ac4ca0 100644
> --- a/arch/arm64/net/bpf_jit_comp.c
> +++ b/arch/arm64/net/bpf_jit_comp.c
> @@ -2520,21 +2520,6 @@ static int prepare_trampoline(struct jit_ctx *ctx, struct bpf_tramp_image *im,
> return ctx->idx;
> }
>
> -static int btf_func_model_nregs(const struct btf_func_model *m)
> -{
> - int nregs = m->nr_args;
> - int i;
> -
> - /* extra registers needed for struct argument */
> - for (i = 0; i < MAX_BPF_FUNC_ARGS; i++) {
> - /* The arg_size is at most 16 bytes, enforced by the verifier. */
> - if (m->arg_flags[i] & BTF_FMODEL_STRUCT_ARG)
> - nregs += (m->arg_size[i] + 7) / 8 - 1;
> - }
> -
> - return nregs;
> -}
> -
> int arch_bpf_trampoline_size(const struct btf_func_model *m, u32 flags,
> struct bpf_tramp_links *tlinks, void *func_addr)
> {
> @@ -2543,10 +2528,8 @@ int arch_bpf_trampoline_size(const struct btf_func_model *m, u32 flags,
> .idx = 0,
> };
> struct bpf_tramp_image im;
> - struct arg_aux aaux;
> - int nregs, ret;
> -
> - nregs = btf_func_model_nregs(m);
> + struct arg_aux aaux;
> + int ret;
>
> ret = calc_arg_aux(m, &aaux);
> if (ret < 0)
Oops, sorry for not noticing that nregs is set but not used.
Now that the number of regs for both struct and non-struct
args is calculated in calc_arg_aux(), we can safely drop
btf_func_model_nregs().
Acked-by: Xu Kuohai <xukuohai@huawei.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH bpf-next] bpf, arm64: Remove unused-but-set function and variable.
2025-05-28 0:27 [PATCH bpf-next] bpf, arm64: Remove unused-but-set function and variable Alexei Starovoitov
2025-05-28 2:28 ` Xu Kuohai
@ 2025-05-28 3:20 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-05-28 3:20 UTC (permalink / raw)
To: Alexei Starovoitov
Cc: bpf, daniel, andrii, martin.lau, xukuohai, alexis.lothore,
kernel-team
Hello:
This patch was applied to bpf/bpf-next.git (master)
by Andrii Nakryiko <andrii@kernel.org>:
On Tue, 27 May 2025 17:27:04 -0700 you wrote:
> From: Alexei Starovoitov <ast@kernel.org>
>
> Remove unused-but-set function and variable to fix the build warning:
> arch/arm64/net/bpf_jit_comp.c: In function 'arch_bpf_trampoline_size':
> >> arch/arm64/net/bpf_jit_comp.c:2547:6: warning: variable 'nregs' set but not used [-Wunused-but-set-variable]
> 2547 | int nregs, ret;
> | ^~~~~
>
> [...]
Here is the summary with links:
- [bpf-next] bpf, arm64: Remove unused-but-set function and variable.
https://git.kernel.org/bpf/bpf-next/c/c5cebb241e27
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-05-28 3:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-28 0:27 [PATCH bpf-next] bpf, arm64: Remove unused-but-set function and variable Alexei Starovoitov
2025-05-28 2:28 ` Xu Kuohai
2025-05-28 3:20 ` patchwork-bot+netdevbpf
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.