access_ok no longer needs a 'type' parameter in the 5.0 kernel.
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Tony Hutter <hutter2@llnl.gov>
Closes #8261
--- /dev/null
+dnl #
+dnl # Linux 5.0: access_ok() drops 'type' parameter:
+dnl #
+dnl # - access_ok(type, addr, size)
+dnl # + access_ok(addr, size)
+dnl #
+AC_DEFUN([ZFS_AC_KERNEL_ACCESS_OK_TYPE], [
+ AC_MSG_CHECKING([whether access_ok() has 'type' parameter])
+ ZFS_LINUX_TRY_COMPILE([
+ #include <linux/uaccess.h>
+ ],[
+ const void __user __attribute__((unused)) *addr = (void *) 0xdeadbeef;
+ unsigned long __attribute__((unused)) size = 1;
+ int error __attribute__((unused)) = access_ok(0, addr, size);
+ ],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_ACCESS_OK_TYPE, 1, [kernel has access_ok with 'type' parameter])
+ ],[
+ AC_MSG_RESULT(no)
+ ])
+])
ZFS_AC_KERNEL
ZFS_AC_SPL
ZFS_AC_QAT
+ ZFS_AC_KERNEL_ACCESS_OK_TYPE
ZFS_AC_TEST_MODULE
ZFS_AC_KERNEL_MISC_MINOR
ZFS_AC_KERNEL_OBJTOOL
#define _ZFS_KMAP_H
#include <linux/highmem.h>
+#include <linux/uaccess.h>
#ifdef HAVE_1ARG_KMAP_ATOMIC
/* 2.6.37 API change */
#define zfs_kunmap_atomic(addr, km_type) kunmap_atomic(addr, km_type)
#endif
+/* 5.0 API change - no more 'type' argument for access_ok() */
+#ifdef HAVE_ACCESS_OK_TYPE
+#define zfs_access_ok(type, addr, size) access_ok(type, addr, size)
+#else
+#define zfs_access_ok(type, addr, size) access_ok(addr, size)
+#endif
+
#endif /* _ZFS_KMAP_H */
return (EFAULT);
} else {
if (uio->uio_fault_disable) {
- if (!access_ok(VERIFY_READ,
+ if (!zfs_access_ok(VERIFY_READ,
(iov->iov_base + skip), cnt)) {
return (EFAULT);
}
-
pagefault_disable();
if (__copy_from_user_inatomic(p,
(iov->iov_base + skip), cnt)) {