Browse Source

Merge pull request #61 from rkitover/pre_5_0_access_ok

support pre-5.0 access_ok() API
Tomás Pinho 6 years ago
parent
commit
f450fd1ced
1 changed files with 4 additions and 0 deletions
  1. 4 0
      os_dep/linux/rtw_android.c

+ 4 - 0
os_dep/linux/rtw_android.c

@@ -662,7 +662,11 @@ int rtw_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd)
 		goto exit;
 		goto exit;
 	}
 	}
 
 
+#if (LINUX_KERNEL_VERSION >= KERNEL_VERSION(5,0,0))
 	if (!access_ok(priv_cmd.buf, priv_cmd.total_len)) {
 	if (!access_ok(priv_cmd.buf, priv_cmd.total_len)) {
+#else
+	if (!access_ok(VERIFY_READ, priv_cmd.buf, priv_cmd.total_len)) {
+#endif
 		RTW_INFO("%s: failed to access memory\n", __FUNCTION__);
 		RTW_INFO("%s: failed to access memory\n", __FUNCTION__);
 		ret = -EFAULT;
 		ret = -EFAULT;
 		goto exit;
 		goto exit;