aecc7617 |
From af5b37cb95ae43815e7399c92596856a1bbacd2a Mon Sep 17 00:00:00 2001
From: Alexey Makhalov <amakhalov@vmware.com>
Date: Tue, 26 Dec 2017 20:43:49 +0000
Subject: [PATCH] Fix building for v4.14 kernel
---
runtime/kp_transport.c | 2 +-
runtime/kp_vm.c | 3 ++-
runtime/lib_base.c | 2 +-
runtime/lib_kdebug.c | 2 +-
4 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/runtime/kp_transport.c b/runtime/kp_transport.c
index 4f76bbd..09a6f87 100644
--- a/runtime/kp_transport.c
+++ b/runtime/kp_transport.c
@@ -119,7 +119,7 @@ static void trace_consume(struct trace_iterator *iter)
&iter->lost_events);
}
-unsigned long long ns2usecs(cycle_t nsec)
+unsigned long long ns2usecs(u64 nsec)
{
nsec += 500;
do_div(nsec, 1000);
diff --git a/runtime/kp_vm.c b/runtime/kp_vm.c
index 0b4787c..761b51b 100644
--- a/runtime/kp_vm.c
+++ b/runtime/kp_vm.c
@@ -1367,7 +1367,8 @@ static int init_arguments(ktap_state_t *ks, int argc, char __user **user_argv)
int len;
int res;
- len = strlen_user(ustr);
+ /* +2 including final NUL */
+ len = strnlen_user(ustr, 0x1002);
if (len > 0x1000) {
ret = -EINVAL;
break;
diff --git a/runtime/lib_base.c b/runtime/lib_base.c
index 691f7d4..420b4b4 100644
--- a/runtime/lib_base.c
+++ b/runtime/lib_base.c
@@ -151,7 +151,7 @@ static int kplib_stack(ktap_state_t *ks)
#endif
-extern unsigned long long ns2usecs(cycle_t nsec);
+extern unsigned long long ns2usecs(u64 nsec);
static int kplib_print_trace_clock(ktap_state_t *ks)
{
unsigned long long t;
diff --git a/runtime/lib_kdebug.c b/runtime/lib_kdebug.c
index ecd7cbe..f7ed11f 100644
--- a/runtime/lib_kdebug.c
+++ b/runtime/lib_kdebug.c
@@ -70,7 +70,7 @@ static int kplib_kdebug_trace_by_id(ktap_state_t *ks)
if (eventsdesc.filter) {
int len;
- len = strlen_user(eventsdesc.filter);
+ len = strnlen_user(eventsdesc.filter, 0x1002);
if (len > 0x1000)
return -1;
--
2.14.2
|