* [PATCH 1/2] tracing: replace simple_strtol() by kstrtoint()
@ 2019-07-15 8:58 xywang.sjtu
2019-07-15 8:58 ` [PATCH 2/2] ftrace: replace simple_strtol() by kstrtol() xywang.sjtu
2019-07-16 21:33 ` [PATCH 1/2] tracing: replace simple_strtol() by kstrtoint() Steven Rostedt
0 siblings, 2 replies; 3+ messages in thread
From: xywang.sjtu @ 2019-07-15 8:58 UTC (permalink / raw)
To: rostedt, mingo; +Cc: linux-kernel, Wang Xiayang
From: Wang Xiayang <xywang.sjtu@sjtu.edu.cn>
The simple_strtol() function is deprecated. kstrto[l,int]() are
the correct replacements as they can properly handle overflows.
This patch replaces the deprecated simple_strtol() use introduced recently.
As skip_entries is actually int-typed, we are safe to use kstrtoint() here.
Same as before, set 0 to skip_entries on string parsing error.
Fixes: dbfe67334a17 ("tracing: kdb: The skip_lines parameter should have been skip_entries")
Signed-off-by: Wang Xiayang <xywang.sjtu@sjtu.edu.cn>
---
kernel/trace/trace_kdb.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/kernel/trace/trace_kdb.c b/kernel/trace/trace_kdb.c
index cca65044c14c..5d9dd4c3f23f 100644
--- a/kernel/trace/trace_kdb.c
+++ b/kernel/trace/trace_kdb.c
@@ -104,8 +104,7 @@ static int kdb_ftdump(int argc, const char **argv)
return KDB_ARGCOUNT;
if (argc) {
- skip_entries = simple_strtol(argv[1], &cp, 0);
- if (*cp)
+ if (kstrtoint(argv[1], 0, &skip_entries))
skip_entries = 0;
}
--
2.11.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] ftrace: replace simple_strtol() by kstrtol()
2019-07-15 8:58 [PATCH 1/2] tracing: replace simple_strtol() by kstrtoint() xywang.sjtu
@ 2019-07-15 8:58 ` xywang.sjtu
2019-07-16 21:33 ` [PATCH 1/2] tracing: replace simple_strtol() by kstrtoint() Steven Rostedt
1 sibling, 0 replies; 3+ messages in thread
From: xywang.sjtu @ 2019-07-15 8:58 UTC (permalink / raw)
To: rostedt, mingo; +Cc: linux-kernel, Wang Xiayang
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] tracing: replace simple_strtol() by kstrtoint()
2019-07-15 8:58 [PATCH 1/2] tracing: replace simple_strtol() by kstrtoint() xywang.sjtu
2019-07-15 8:58 ` [PATCH 2/2] ftrace: replace simple_strtol() by kstrtol() xywang.sjtu
@ 2019-07-16 21:33 ` Steven Rostedt
1 sibling, 0 replies; 3+ messages in thread
From: Steven Rostedt @ 2019-07-16 21:33 UTC (permalink / raw)
To: xywang.sjtu; +Cc: mingo, linux-kernel
On Mon, 15 Jul 2019 16:58:55 +0800
xywang.sjtu@sjtu.edu.cn wrote:
> From: Wang Xiayang <xywang.sjtu@sjtu.edu.cn>
>
> The simple_strtol() function is deprecated. kstrto[l,int]() are
> the correct replacements as they can properly handle overflows.
>
> This patch replaces the deprecated simple_strtol() use introduced recently.
> As skip_entries is actually int-typed, we are safe to use kstrtoint() here.
>
> Same as before, set 0 to skip_entries on string parsing error.
>
> Fixes: dbfe67334a17 ("tracing: kdb: The skip_lines parameter should have been skip_entries")
This patch doesn't "fix" anything. It's more of a clean up.
I'll look at it after the merge window. Same for the other patch.
-- Steve
> Signed-off-by: Wang Xiayang <xywang.sjtu@sjtu.edu.cn>
> ---
> kernel/trace/trace_kdb.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/kernel/trace/trace_kdb.c b/kernel/trace/trace_kdb.c
> index cca65044c14c..5d9dd4c3f23f 100644
> --- a/kernel/trace/trace_kdb.c
> +++ b/kernel/trace/trace_kdb.c
> @@ -104,8 +104,7 @@ static int kdb_ftdump(int argc, const char **argv)
> return KDB_ARGCOUNT;
>
> if (argc) {
> - skip_entries = simple_strtol(argv[1], &cp, 0);
> - if (*cp)
> + if (kstrtoint(argv[1], 0, &skip_entries))
> skip_entries = 0;
> }
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-07-16 21:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-15 8:58 [PATCH 1/2] tracing: replace simple_strtol() by kstrtoint() xywang.sjtu
2019-07-15 8:58 ` [PATCH 2/2] ftrace: replace simple_strtol() by kstrtol() xywang.sjtu
2019-07-16 21:33 ` [PATCH 1/2] tracing: replace simple_strtol() by kstrtoint() Steven Rostedt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).