kernel/kernel-modules/intel-opae-fpga/centos/patches/Fix-compile-error-with-CentOS-8.1-4.18.0-147-kernel.patch
Dongqi Chen 243b56cfb8 Update intel-opae-fpga driver to build with 4.18 kernel from CentOS 8
(cherry picked from commit 734f29df903e075e1084e5c5027aa02b0cfcccb6)

driver sign method is updated to align with 4.18 kernel.
There is a compile issue due to 4.18 kernel in CentOS 8 contains
upstream 5.x kernel's change. Fix it by force code to go with
5.x kernel path.

Add Fix-wrong-kernel-version.patch
Fix command 'uname -r' error to get host kernel version

Change-Id: I32592614a6457dde6c68fb13b5380e5caa0328e1
Story: 2007308
Task: 38803
Depends-On: https://review.opendev.org/720325
Signed-off-by: Shuicheng Lin <shuicheng.lin@intel.com>
Signed-off-by: Dongqi Chen <chen.dq@neusoft.com>
2020-04-24 11:02:29 +08:00

64 lines
2.3 KiB
Diff

From 36259496411e8d2e20bde91e93c9fcb83d9daa1d Mon Sep 17 00:00:00 2001
From: Shuicheng Lin <shuicheng.lin@intel.com>
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 <shuicheng.lin@intel.com>
---
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