History

sparse: use static inline for __chk_{user,io}_ptr()

__chk_user_ptr() & __chk_io_ptr() are dummy extern functions which only exist to enforce the typechecking of __user or __iomem pointers in macros when using sparse. This typechecking is done by inserting a call to these functions. But the presence of these calls can inhibit some simplifications and so influence the result of sparse's analysis of context/locking. Fix this by changing these calls into static inline calls with an empty body.

Luc Van Oostenryck committed 6 years ago

Commit e5fc4361 parent 5861af91 file · +2 −2Browse files

Showing the changes to include/linux (1 of 1 file). Show all

Unified · Split

include/linux/compiler_types.h+2−2
@@ -11,8 +11,8 @@ · 10 unmodified lines
11# define __iomem __attribute__((noderef, address_space(__iomem)))11# define __iomem __attribute__((noderef, address_space(__iomem)))
12# define __percpu __attribute__((noderef, address_space(__percpu)))12# define __percpu __attribute__((noderef, address_space(__percpu)))
13# define __rcu __attribute__((noderef, address_space(__rcu)))13# define __rcu __attribute__((noderef, address_space(__rcu)))
14extern void __chk_user_ptr(const volatile void __user *);14static inline void __chk_user_ptr(const volatile void __user *ptr) { }
15extern void __chk_io_ptr(const volatile void __iomem *);15static inline void __chk_io_ptr(const volatile void __iomem *ptr) { }
16/* context/locking */16/* context/locking */
17# define __must_hold(x) __attribute__((context(x,1,1)))17# define __must_hold(x) __attribute__((context(x,1,1)))
18# define __acquires(x) __attribute__((context(x,0,1)))18# define __acquires(x) __attribute__((context(x,0,1)))