Re: [PATCH] selftests/bpf: Remove unneeded variable "ret"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 6/13/23 1:50 AM, baomingtong001@xxxxxxxxxx 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@xxxxxxxxxx>
---
  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")




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux