I came across some macros with the definitions like this:
#ifdef __CHECKER__
# define __user __attribute__((noderef, address_space(1)))
And I know those are merely to be used with sparse(__CHECKER__) and GCC ignores them completely.But what I don't get is that what does address_space()
actually mean? What are the possible values for it? Looks like the only documentation for it is a post from linus in the mailing list around 16 years ago which says:
When you do use parse, it is another matter entirely. For "sparse", that "__iomem" has lots of meaning:
# define __iomem __attribute__((noderef, address_space(2)))
ie "iomem" means two separate things: it means that sparse should complain if the pointer is ever dereferenced (it's a "noderef" pointer) directly, and it's in "address space 2" as opposed to the normal address space (0).
From similar Q&As like this and this I figured out that 3 means per-cpu pointers and 1 seems to be related to the pointers received from userspace.And also 0 for normal pointers.
But what does address_space(2) actually mean?
Are {0,1,2,3} the only possible values?
Thanks.