diff options
| author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-12-03 17:50:25 +0100 |
|---|---|---|
| committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-12-12 18:48:52 +0100 |
| commit | 2da3f3cdd4b6817553b7290806cd7f84476d8fb6 (patch) | |
| tree | 46ad9e2905237cc2f45c41bde48d93c024e72422 /validation | |
| parent | 69fce9f7bc6f81231953b4551e574dd90fc10e45 (diff) | |
| download | sparse-dev-2da3f3cdd4b6817553b7290806cd7f84476d8fb6.tar.gz | |
as-name: allow ident as address_space
Currently, address space 1 is displayed as '<asn:1>' and so on.
Now that address spaces can be displayed by name, the address space
number should just be an implementation detail and it would make
more sense the be able to 'declare' these address space directly
by name, like:
#define __user attribute((noderef, address_space(__user)))
Since directly using the name instead of an number creates some
problems internally, allow this syntax but for the moment keep
the address space number and use a table to lookup the number
from the name.
References: https://marc.info/?l=linux-sparse&m=153627490128505
Idea-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'validation')
| -rw-r--r-- | validation/as-name.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/validation/as-name.c b/validation/as-name.c new file mode 100644 index 00000000..4dd65798 --- /dev/null +++ b/validation/as-name.c @@ -0,0 +1,17 @@ +#define __user __attribute__((address_space(__user))) + +extern void fun(void *addr); + +static void foo(void __user *ptr) +{ + return fun(ptr); +} +/* + * check-name: as-name attribute + * + * check-error-start +as-name.c:7:20: warning: incorrect type in argument 1 (different address spaces) +as-name.c:7:20: expected void *addr +as-name.c:7:20: got void __user *ptr + * check-error-end + */ |
