Skip to content

Commit e5fc436

Browse files
lucvooojeda
authored andcommitted
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. Signed-off-by: Luc Van Oostenryck <[email protected]> Signed-off-by: Miguel Ojeda <[email protected]>
1 parent 5861af9 commit e5fc436

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

include/linux/compiler_types.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
# define __iomem __attribute__((noderef, address_space(__iomem)))
1212
# define __percpu __attribute__((noderef, address_space(__percpu)))
1313
# define __rcu __attribute__((noderef, address_space(__rcu)))
14-
extern void __chk_user_ptr(const volatile void __user *);
15-
extern void __chk_io_ptr(const volatile void __iomem *);
14+
static inline void __chk_user_ptr(const volatile void __user *ptr) { }
15+
static inline void __chk_io_ptr(const volatile void __iomem *ptr) { }
1616
/* context/locking */
1717
# define __must_hold(x) __attribute__((context(x,1,1)))
1818
# define __acquires(x) __attribute__((context(x,0,1)))

0 commit comments

Comments
 (0)