diff options
author | Riku Nomoto <riku_nomoto@mail.toyota.co.jp> | 2020-11-20 04:49:50 +0900 |
---|---|---|
committer | Riku Nomoto <riku_nomoto@mail.toyota.co.jp> | 2020-11-20 06:36:39 +0000 |
commit | f244c912f1393e3a1246ccd1c9d591e38ad080f5 (patch) | |
tree | 613726c1a8d0afed819b30516c43f9095c09ee3e /kernel-module-evklib | |
parent | 8e0e00d21146a84c18f9cf9409e187b4fb0248aa (diff) |
kernel-module-evklib: Support for kernel 5.0 and up
We revised mulutiple points because argument:"type" of access_ok() function is deleted.
Signed-off-by: Riku Nomoto <riku_nomoto@mail.toyota.co.jp>
Change-Id: I11d5a513895a7f49fc5593055236c4306d2a4401
Diffstat (limited to 'kernel-module-evklib')
-rwxr-xr-x | kernel-module-evklib/evk_lib.c | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/kernel-module-evklib/evk_lib.c b/kernel-module-evklib/evk_lib.c index d5c1718..05d881a 100755 --- a/kernel-module-evklib/evk_lib.c +++ b/kernel-module-evklib/evk_lib.c @@ -1286,7 +1286,11 @@ evk_ioctl(struct file *filp, unsigned int cmd, break; case EVK_IOC_CREATE_MESSAGE_QUEUE: - if (access_ok(VERIFY_READ, arg, sizeof(mesq))) { /* pgr0039 */ +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0)) + if (access_ok(arg, sizeof(mesq))) { /* pgr0039 */ +#else + if (access_ok(VERIFY_READ, arg, sizeof(mesq))) { /* pgr0039 */ +#endif if (copy_from_user(&mesq, (EV_Flag *)arg, sizeof(mesq))) { ret = -EFAULT; break; @@ -1300,7 +1304,11 @@ evk_ioctl(struct file *filp, unsigned int cmd, break; case EVK_IOC_ALLOC_FLAG_ID: +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0)) + if (access_ok(arg, sizeof(queueID))) { /* pgr0039 */ +#else if (access_ok(VERIFY_WRITE, arg, sizeof(queueID))) { /* pgr0039 */ +#endif evk_alloc_flagID(&queueID); if (put_user(queueID, (EV_ID *)arg)) { /* pgr0039 */ ret = -EFAULT; @@ -1313,7 +1321,11 @@ evk_ioctl(struct file *filp, unsigned int cmd, break; case EVK_IOC_ALLOC_FLAG64_ID: +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0)) + if (access_ok(arg, sizeof(queueID))) { /* pgr0039 */ +#else if (access_ok(VERIFY_WRITE, arg, sizeof(queueID))) { /* pgr0039 */ +#endif evk_alloc_flag64ID(&queueID); if (put_user(queueID, (EV_ID *)arg)) { /* pgr0039 */ ret = -EFAULT; @@ -1326,7 +1338,11 @@ evk_ioctl(struct file *filp, unsigned int cmd, break; case EVK_IOC_ALLOC_QUEUE_ID: +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0)) + if (access_ok(arg, sizeof(queueID))) { /* pgr0039 */ +#else if (access_ok(VERIFY_WRITE, arg, sizeof(queueID))) { /* pgr0039 */ +#endif evk_alloc_queueID(&queueID); if (put_user(queueID, (EV_ID *)arg)) { /* pgr0039 */ ret = -EFAULT; @@ -1344,7 +1360,11 @@ evk_ioctl(struct file *filp, unsigned int cmd, break; case EVK_IOC_STORE_FLAG: +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0)) + if (access_ok(arg, sizeof(EV_Flag))) { /* pgr0039 */ +#else if (access_ok(VERIFY_READ, arg, sizeof(EV_Flag))) { /* pgr0039 */ +#endif ret = evk_store_flag((EV_Flag *)arg, evk_mem_user); } else { ret = -EFAULT; @@ -1352,7 +1372,11 @@ evk_ioctl(struct file *filp, unsigned int cmd, break; case EVK_IOC_STORE_FLAG64: +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0)) + if (access_ok(arg, sizeof(EV_Flag64))) { /* pgr0039 */ +#else if (access_ok(VERIFY_READ, arg, sizeof(EV_Flag64))) { /* pgr0039 */ +#endif ret = evk_store_flag64((EV_Flag64 *)arg, evk_mem_user); } else { ret = -EFAULT; @@ -1360,7 +1384,11 @@ evk_ioctl(struct file *filp, unsigned int cmd, break; case EVK_IOC_STORE_MESSAGE: +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0)) + if (access_ok(arg, sizeof(EV_Message))) { /* pgr0039 */ +#else if (access_ok(VERIFY_READ, arg, sizeof(EV_Message))) { /* pgr0039 */ +#endif ret = evk_store_message((EV_Message *)arg, evk_mem_user); } else { ret = -EFAULT; @@ -1388,7 +1416,11 @@ evk_ioctl(struct file *filp, unsigned int cmd, peek_only = 0; wait = 0; get_event: +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0)) + if (access_ok(arg, sizeof(EV_Event))) { /* pgr0039 */ +#else if (access_ok(VERIFY_WRITE, arg, sizeof(EV_Event))) { /* pgr0039 */ +#endif ret = evk_get_event((EV_Event *)arg, peek_only, wait, evk_mem_user); } else { ret = -EFAULT; @@ -1403,7 +1435,11 @@ evk_ioctl(struct file *filp, unsigned int cmd, case EVK_IOC_GET_NEXT_EVENT: peek_only = 0; get_next: +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0)) + if (access_ok(arg, sizeof(EVK_Next_Event_Query))) { /* pgr0039 */ +#else if (access_ok(VERIFY_WRITE, arg, sizeof(EVK_Next_Event_Query))) { /* pgr0039 */ +#endif ret = evk_get_next_event((EVK_Next_Event_Query *)arg, peek_only); } else { ret = -EFAULT; |