Skip to content

Instantly share code, notes, and snippets.

@b1tninja
Created March 7, 2019 17:32
Show Gist options
  • Save b1tninja/79047b199a44404b4fba5f45cd903a94 to your computer and use it in GitHub Desktop.
Save b1tninja/79047b199a44404b4fba5f45cd903a94 to your computer and use it in GitHub Desktop.
New uaccess.h access_ok macro has no type parameter. This ignores one if given.
diff --git a/include/asm-generic/uaccess.h b/include/asm-generic/uaccess.h
index d82c78a79da5..7edb6ab268ad 100644
--- a/include/asm-generic/uaccess.h
+++ b/include/asm-generic/uaccess.h
@@ -38 +38,5 @@ static inline void set_fs(mm_segment_t fs)
-#define access_ok(addr, size) __access_ok((unsigned long)(addr),(size))
+#define __typed_access_ok(type, addr, size) __access_ok((unsigned long)(addr),(size)) \
+ #warning uaccess.h access_ok macro no longer has a type parameter.
+#define __untyped_access_ok(addr, size) __access_ok((unsigned long)(addr),(size))
+#define __get_access_ok(_1,_2,_3,NAME,...) NAME
+#define access_ok(...) __get_access_ok(__VA_ARGS__, __typed_access_ok, __untyped_access_ok)(__VA_ARGS__)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment