db/fixup_kernel.sh: fix clear_user() handling
[smatch.git] / validation / Waddress-space-strict.c
bloba1c5b2771e87bc05533e8d12ac8d22fe7c3d10fb
1 #define __user __attribute__((address_space(1)))
3 typedef unsigned long ulong;
4 typedef struct s obj_t;
6 static void expl(ulong u, void *v, obj_t *o, obj_t __user *p)
8 (obj_t*)(u);
9 (obj_t __user*)(u);
11 (obj_t*)(v);
12 (obj_t __user*)(v);
14 (ulong)(o);
15 (void *)(o);
16 (obj_t*)(o);
17 (obj_t __user*)(o);
19 (ulong)(p); // w!
20 (void *)(p); // w
21 (obj_t*)(p); // w
22 (obj_t __user*)(p); // ok
26 * check-name: Waddress-space-strict
27 * check-command: sparse -Wcast-from-as -Wcast-to-as $file
29 * check-error-start
30 Waddress-space-strict.c:12:10: warning: cast adds address space '<asn:1>' to expression
31 Waddress-space-strict.c:17:10: warning: cast adds address space '<asn:1>' to expression
32 Waddress-space-strict.c:19:10: warning: cast removes address space '<asn:1>' of expression
33 Waddress-space-strict.c:20:10: warning: cast removes address space '<asn:1>' of expression
34 Waddress-space-strict.c:21:10: warning: cast removes address space '<asn:1>' of expression
35 * check-error-end