lkml.org 
[lkml]   [2019]   [Jul]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 2/2] ftrace: replace simple_strtol() by kstrtol()
Date
From: Wang Xiayang <xywang.sjtu@sjtu.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@sjtu.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
\
 
 \ /
  Last update: 2019-07-15 11:25    [W:0.034 / U:43.336 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site