assigned_expr: add reverse links
[smatch.git] / validation / sm_user_data4.c
blob644d8e5b406d2c26bc0cca4453325a2fb95f29d7
1 #include "check_debug.h"
3 int copy_from_user(void *dest, void *src, int size);
5 struct ear {
6 int x, y;
7 };
9 void *src;
10 int returns_user_data(void)
12 int x;
14 copy_from_user(&x, src, sizeof(int));
15 return x;
18 struct ear *dest;
19 struct ear *returns_user_member(void)
21 copy_from_user(&dest->x, src, sizeof(int));
22 return dest;
24 void test(void)
26 struct ear *p;
27 int x;
29 x = returns_user_data();
30 __smatch_state("check_user_data", "x");
31 p = returns_user_member();
32 __smatch_state("check_user_data", "p");
33 __smatch_state("check_user_data", "p->x");
37 * check-name: smatch user data #4
38 * check-command: smatch -p=kernel -I.. sm_user_data4.c
40 * check-output-start
41 sm_user_data4.c:30 test() 'x' = 'user_data_set'
42 sm_user_data4.c:32 test() check_user_data 'p' not found
43 sm_user_data4.c:33 test() 'p->x' = 'user_data_set'
44 * check-output-end