Upstream commit
96d4f267e40f95 ("Remove 'type' argument from access_ok()
function") removes the first argument to access_ok.
Adjust the code so it builds with Linux 5.4.
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Mathias Kresin <dev@kresin.me>
return -ENOTTY;
if ( _IOC_DIR(cmd) & _IOC_READ )
return -ENOTTY;
if ( _IOC_DIR(cmd) & _IOC_READ )
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,0,0)
+ ret = !access_ok(arg, _IOC_SIZE(cmd));
+#else
ret = !access_ok(VERIFY_WRITE, arg, _IOC_SIZE(cmd));
ret = !access_ok(VERIFY_WRITE, arg, _IOC_SIZE(cmd));
else if ( _IOC_DIR(cmd) & _IOC_WRITE )
else if ( _IOC_DIR(cmd) & _IOC_WRITE )
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,0,0)
+ ret = !access_ok(arg, _IOC_SIZE(cmd));
+#else
ret = !access_ok(VERIFY_READ, arg, _IOC_SIZE(cmd));
ret = !access_ok(VERIFY_READ, arg, _IOC_SIZE(cmd));
if ( ret )
return -EFAULT;
if ( ret )
return -EFAULT;