[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190715085856.5664-2-xywang.sjtu@sjtu.edu.cn>
Date: Mon, 15 Jul 2019 16:58:56 +0800
From: xywang.sjtu@...u.edu.cn
To: rostedt@...dmis.org, mingo@...hat.com
Cc: linux-kernel@...r.kernel.org,
Wang Xiayang <xywang.sjtu@...u.edu.cn>
Subject: [PATCH 2/2] ftrace: replace simple_strtol() by kstrtol()
From: Wang Xiayang <xywang.sjtu@...u.edu.cn>
The simple_strtol() function is deprecated. kstrtol() is
the correct replacement as it can properly handle overflows.
This patch replaces the deprecated simple_strtol() use introduced recently.
Same as the case of invalid index, it returns zero on string parsing error.
Fixes: f79b3f338564 ("ftrace: Allow enabling of filters via index of available_filter_functions")
Signed-off-by: Wang Xiayang <xywang.sjtu@...u.edu.cn>
---
kernel/trace/ftrace.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 576c41644e77..2baabf51a61a 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -3701,10 +3701,13 @@ static int
add_rec_by_index(struct ftrace_hash *hash, struct ftrace_glob *func_g,
int clear_filter)
{
- long index = simple_strtoul(func_g->search, NULL, 0);
+ long index;
struct ftrace_page *pg;
struct dyn_ftrace *rec;
+ if (kstrtoul(func_g->search, 0, &index))
+ return 0;
+
/* The index starts at 1 */
if (--index < 0)
return 0;
--
2.11.0
Powered by blists - more mailing lists