linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: xywang.sjtu@sjtu.edu.cn
To: rostedt@goodmis.org, mingo@redhat.com
Cc: linux-kernel@vger.kernel.org, Wang Xiayang <xywang.sjtu@sjtu.edu.cn>
Subject: [PATCH 1/2] tracing: replace simple_strtol() by kstrtoint()
Date: Mon, 15 Jul 2019 16:58:55 +0800	[thread overview]
Message-ID: <20190715085856.5664-1-xywang.sjtu@sjtu.edu.cn> (raw)

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


             reply	other threads:[~2019-07-15  9:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-15  8:58 xywang.sjtu [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190715085856.5664-1-xywang.sjtu@sjtu.edu.cn \
    --to=xywang.sjtu@sjtu.edu.cn \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).