expressions: make assign_expression() take an op argument
[smatch.git] / validation / sm_skb.c
blobccd738c0c03e3a30fcd7abb4272ef0386e163352
1 struct sk_buff {
2 int valuable_information;
3 };
4 struct foo {
5 int x;
6 };
7 struct ture {
8 struct sk_buff *skb;
9 };
11 struct wrap1 {
12 struct ture *a;
14 struct wrap2 {
15 struct foo *c;
16 struct wrap1 *b;
18 struct wrap3 {
19 struct foo *c;
22 struct sk_buff *skb;
23 struct sk_buff **ptr;
24 struct ture *x;
25 struct ture xx;
26 struct wrap1 *u;
27 struct wrap2 *y;
28 struct wrap3 *z;
30 void kfree(void *data);
32 void func (void)
34 kfree(skb);
35 kfree(x->skb);
36 kfree(xx.skb);
37 kfree(y->c);
38 kfree(u->a->skb);
39 kfree(u->a);
40 kfree(y->b->a->skb);
41 kfree(z->c);
42 kfree(ptr);
45 * check-name: kfree_skb() test
46 * check-command: smatch -p=kernel sm_skb.c
48 * check-output-start
49 sm_skb.c:34 func() error: use kfree_skb() here instead of kfree(skb)
50 sm_skb.c:35 func() error: use kfree_skb() here instead of kfree(x->skb)
51 sm_skb.c:36 func() error: use kfree_skb() here instead of kfree(xx.skb)
52 sm_skb.c:38 func() error: use kfree_skb() here instead of kfree(u->a->skb)
53 sm_skb.c:40 func() error: use kfree_skb() here instead of kfree(y->b->a->skb)
54 * check-output-end