From: Yonghong Song <yhs@meta.com>
To: baomingtong001@208suo.com, ast@kernel.org, daniel@iogearbox.net,
andrii@kernel.org, martin.lau@linux.dev, song@kernel.org,
yhs@fb.com, john.fastabend@gmail.com, kpsingh@kernel.org,
sdf@google.com, haoluo@google.com, jolsa@kernel.org,
mykolal@fb.com, shuah@kernel.org, jakub@cloudflare.com,
Jakub Kicinski <kuba@kernel.org>
Cc: bpf@vger.kernel.org, linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] selftests/bpf: Remove unneeded variable "ret"
Date: Tue, 13 Jun 2023 06:42:40 -0700 [thread overview]
Message-ID: <53510828-ee5b-1d91-0f85-b79da4422741@meta.com> (raw)
In-Reply-To: <6228af14241b831be4bae6ebcd63799e@208suo.com>
On 6/13/23 1:50 AM, baomingtong001@208suo.com wrote:
> Fix the following coccicheck warning:
>
> tools/testing/selftests/bpf/progs/tailcall_bpf2bpf6.c:28:14-17: Unneeded
> variable: "ret".
>
> Return "1".
>
> Signed-off-by: Mingtong Bao <baomingtong001@208suo.com>
> ---
> tools/testing/selftests/bpf/progs/tailcall_bpf2bpf6.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/tools/testing/selftests/bpf/progs/tailcall_bpf2bpf6.c
> b/tools/testing/selftests/bpf/progs/tailcall_bpf2bpf6.c
> index 4a9f63bea66c..7f0146682577 100644
> --- a/tools/testing/selftests/bpf/progs/tailcall_bpf2bpf6.c
> +++ b/tools/testing/selftests/bpf/progs/tailcall_bpf2bpf6.c
> @@ -25,10 +25,9 @@ static __noinline
> int subprog_tail(struct __sk_buff *skb)
> {
> /* Don't propagate the constant to the caller */
> - volatile int ret = 1;
>
> bpf_tail_call_static(skb, &jmp_table, 0);
> - return ret;
> + return 1;
Please pay attention to the comment:
/* Don't propagate the constant to the caller */
which clearly says 'constant' is not preferred.
The patch introduced this change is:
5e0b0a4c52d30 selftests/bpf: Test tail call counting with bpf2bpf
and data on stack
The test intentionally want to:
'Specifically when the size
of data allocated on BPF stack is not a multiple on 8.'
Note that with volatile and without volatile, the generated
code will be different and it will result in different
verification path.
cc Jakub for further clarification.
> }
>
> SEC("tc")
next parent reply other threads:[~2023-06-13 13:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20230613084315.62021-1-luojianhong@cdjrlc.com>
[not found] ` <6228af14241b831be4bae6ebcd63799e@208suo.com>
2023-06-13 13:42 ` Yonghong Song [this message]
2023-06-13 18:13 ` [PATCH] selftests/bpf: Remove unneeded variable "ret" Jakub Sitnicki
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=53510828-ee5b-1d91-0f85-b79da4422741@meta.com \
--to=yhs@meta.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=baomingtong001@208suo.com \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=haoluo@google.com \
--cc=jakub@cloudflare.com \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kpsingh@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=martin.lau@linux.dev \
--cc=mykolal@fb.com \
--cc=sdf@google.com \
--cc=shuah@kernel.org \
--cc=song@kernel.org \
--cc=yhs@fb.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox