|
@@ -68,6 +68,12 @@ static inline bool __chk_range_not_ok(unsigned long addr, unsigned long size, un
|
|
__chk_range_not_ok((unsigned long __force)(addr), size, limit); \
|
|
__chk_range_not_ok((unsigned long __force)(addr), size, limit); \
|
|
})
|
|
})
|
|
|
|
|
|
|
|
+#ifdef CONFIG_DEBUG_ATOMIC_SLEEP
|
|
|
|
+# define WARN_ON_IN_IRQ() WARN_ON_ONCE(!in_task())
|
|
|
|
+#else
|
|
|
|
+# define WARN_ON_IN_IRQ()
|
|
|
|
+#endif
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* access_ok: - Checks if a user space pointer is valid
|
|
* access_ok: - Checks if a user space pointer is valid
|
|
* @type: Type of access: %VERIFY_READ or %VERIFY_WRITE. Note that
|
|
* @type: Type of access: %VERIFY_READ or %VERIFY_WRITE. Note that
|
|
@@ -88,8 +94,11 @@ static inline bool __chk_range_not_ok(unsigned long addr, unsigned long size, un
|
|
* checks that the pointer is in the user space range - after calling
|
|
* checks that the pointer is in the user space range - after calling
|
|
* this function, memory access functions may still return -EFAULT.
|
|
* this function, memory access functions may still return -EFAULT.
|
|
*/
|
|
*/
|
|
-#define access_ok(type, addr, size) \
|
|
|
|
- likely(!__range_not_ok(addr, size, user_addr_max()))
|
|
|
|
|
|
+#define access_ok(type, addr, size) \
|
|
|
|
+({ \
|
|
|
|
+ WARN_ON_IN_IRQ(); \
|
|
|
|
+ likely(!__range_not_ok(addr, size, user_addr_max())); \
|
|
|
|
+})
|
|
|
|
|
|
/*
|
|
/*
|
|
* These are the main single-value transfer routines. They automatically
|
|
* These are the main single-value transfer routines. They automatically
|