xref: /linux/tools/testing/selftests/bpf/progs/verifier_may_goto_2.c (revision d0d106a2bd21499901299160744e5fe9f4c83ddb)
1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright (c) 2025 Meta Platforms, Inc. and affiliates. */
3 
4 #include "bpf_misc.h"
5 #include "bpf_experimental.h"
6 
7 int gvar;
8 
9 SEC("raw_tp")
10 __description("C code with may_goto 0")
11 __success
may_goto_c_code(void)12 int may_goto_c_code(void)
13 {
14 	int i, tmp[3];
15 
16 	for (i = 0; i < 3 && can_loop; i++)
17 		tmp[i] = 0;
18 
19 	for (i = 0; i < 3 && can_loop; i++)
20 		tmp[i] = gvar - i;
21 
22 	for (i = 0; i < 3 && can_loop; i++)
23 		gvar += tmp[i];
24 
25 	return 0;
26 }
27 
28 char _license[] SEC("license") = "GPL";
29