From 36259496411e8d2e20bde91e93c9fcb83d9daa1d Mon Sep 17 00:00:00 2001 From: Shuicheng Lin Date: Mon, 24 Feb 2020 09:40:22 +0800 Subject: [PATCH] Fix compile error with CentOS 8.1 4.18.0-147 kernel access_ok definition in CentOS 8.1 is the same as linux kernel with version >= 5.0.0, so force the code to go with the correct path. Signed-off-by: Shuicheng Lin --- drivers/fpga/intel/fme-pr.c | 3 ++- drivers/fpga/intel/ifpga-sec-mgr.c | 5 +++-- drivers/misc/avmmi-bmc.c | 3 ++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/fpga/intel/fme-pr.c b/drivers/fpga/intel/fme-pr.c index a5bf846..a65ec0d 100644 --- a/drivers/fpga/intel/fme-pr.c +++ b/drivers/fpga/intel/fme-pr.c @@ -338,7 +338,8 @@ static int fme_pr(struct platform_device *pdev, unsigned long arg) return -EINVAL; } -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0) +/* CentOS 8.1 kernel also contains this change. */ +#if 1 /* LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0) */ if (!access_ok(u64_to_user_ptr(port_pr.buffer_address), port_pr.buffer_size)) return -EFAULT; diff --git a/drivers/fpga/intel/ifpga-sec-mgr.c b/drivers/fpga/intel/ifpga-sec-mgr.c index 56405f2..c32e5b7 100644 --- a/drivers/fpga/intel/ifpga-sec-mgr.c +++ b/drivers/fpga/intel/ifpga-sec-mgr.c @@ -132,8 +132,9 @@ static int ifpga_sec_mgr_ioctl_write_blk(struct ifpga_sec_mgr *imgr, if (wb.size > SIZE_4K) return -ENOMEM; - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0) + +/* CentOS 8.1 kernel also contains this change. */ +#if 1 /* LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0) */ if (!access_ok(u64_to_user_ptr(wb.buf), wb.size)) return -EFAULT; #else diff --git a/drivers/misc/avmmi-bmc.c b/drivers/misc/avmmi-bmc.c index 4716b0d..9bb70a7 100644 --- a/drivers/misc/avmmi-bmc.c +++ b/drivers/misc/avmmi-bmc.c @@ -804,7 +804,8 @@ static long avmmi_bmc_ioctl(struct file *file, unsigned int cmd, if (xact.txlen > MAX_PACKET_SIZE || xact.rxlen > MAX_PACKET_SIZE) return -ENOMEM; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0) +/* CentOS 8.1 kernel also contains this change. */ +#if 1 /* LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0) */ if (!access_ok(u64_to_user_ptr(xact.txbuf), xact.txlen)) return -EFAULT; -- 2.7.4