Repository : ssh://git@open-mesh.org/batman-adv
On branch : master
commit 954cd5d73d339baf69206893f797bd54ee100f33 Author: Sven Eckelmann sven@narfation.org Date: Sat Jan 12 09:57:38 2019 +0100
batman-adv: Provide 3-argument access_ok fallback
The kernels 3.16-3.18 use the 3-arguments access_ok macro in header files. When we remove this version, the build will fail on these kernels. with:
include/net/sock.h:1818:22: error: macro "access_ok" passed 3 arguments, but takes just 2 In file included from net/batman-adv/bridge_loop_avoidance.c:52:0: include/net/sock.h: In function ‘skb_do_copy_data_nocache’: include/net/sock.h:1818:41: error: macro "access_ok" passed 3 arguments, but takes just 2 if (!access_ok(VERIFY_READ, from, copy) || ^ include/net/sock.h:1818:8: error: ‘access_ok’ undeclared (first use in this function) if (!access_ok(VERIFY_READ, from, copy) || ^~~~~~~~~
Fixes: 8af877b11054 ("batman-adv: Remove 'type' argument from access_ok() function") Signed-off-by: Sven Eckelmann sven@narfation.org
954cd5d73d339baf69206893f797bd54ee100f33 compat-include/linux/uaccess.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/compat-include/linux/uaccess.h b/compat-include/linux/uaccess.h index 0cd56a60..3a6ee47d 100644 --- a/compat-include/linux/uaccess.h +++ b/compat-include/linux/uaccess.h @@ -37,7 +37,12 @@ static inline int batadv_access_ok(int type, const void __user *p, #undef access_ok #endif
-#define access_ok(addr, size) batadv_access_ok(VERIFY_WRITE, (addr), (size)) +#define access_ok_get(_1, _2, _3 , access_ok_name, ...) access_ok_name +#define access_ok(...) \ + access_ok_get(__VA_ARGS__, access_ok3, access_ok2)(__VA_ARGS__) + +#define access_ok2(addr, size) batadv_access_ok(VERIFY_WRITE, (addr), (size)) +#define access_ok3(type, addr, size) batadv_access_ok((type), (addr), (size))
#endif /* < KERNEL_VERSION(5, 0, 0) */