1 // SPDX-License-Identifier: GPL-2.0-only 2 /* Copyright (c) 2020 Facebook */ 3 #include <stddef.h> 4 #include <linux/bpf.h> 5 #include <bpf/bpf_helpers.h> 6 7 __attribute__ ((noinline)) f1(struct __sk_buff * skb)8int f1(struct __sk_buff *skb) 9 { 10 return skb->len; 11 } 12 13 int f3(int, struct __sk_buff *skb); 14 15 __attribute__ ((noinline)) f2(int val,struct __sk_buff * skb)16int f2(int val, struct __sk_buff *skb) 17 { 18 return f1(skb) + f3(val, (void *)&val); /* type mismatch */ 19 } 20 21 __attribute__ ((noinline)) f3(int val,struct __sk_buff * skb)22int f3(int val, struct __sk_buff *skb) 23 { 24 return skb->ifindex * val; 25 } 26 27 SEC("classifier/test") test_cls(struct __sk_buff * skb)28int test_cls(struct __sk_buff *skb) 29 { 30 return f1(skb) + f2(2, skb) + f3(3, skb); 31 } 32