From: Andrey Ryabinin <a.ryabinin@samsung.com>
To: Jason Baron <jbaron@akamai.com>
Cc: linux-kernel@vger.kernel.org, Andrey Ryabinin <a.ryabinin@samsung.com>
Subject: [PATCH 2/3] dynamic_debug: fix ddebug_parse_query()
Date: Thu, 23 Jan 2014 17:20:31 +0400 [thread overview]
Message-ID: <1390483232-7160-2-git-send-email-a.ryabinin@samsung.com> (raw)
In-Reply-To: <1390483232-7160-1-git-send-email-a.ryabinin@samsung.com>
This fixes following scenario:
$ echo 'file dynamic_debug.c line 1-123 +p' > /sys/kernel/debug/dynamic_debug/control
-bash: echo: write error: Invalid argument
$ dmesg | grep dynamic_debug
dynamic_debug:ddebug_parse_query: last-line:123 < 1st-line:1
dynamic_debug:ddebug_parse_query: query parse failed
Signed-off-by: Andrey Ryabinin <a.ryabinin@samsung.com>
---
lib/dynamic_debug.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
index f959c39..e488d9a 100644
--- a/lib/dynamic_debug.c
+++ b/lib/dynamic_debug.c
@@ -352,8 +352,10 @@ static int ddebug_parse_query(char *words[], int nwords,
return -EINVAL;
if (last) {
/* range <first>-<last> */
- if (parse_lineno(last, &query->last_lineno)
- < query->first_lineno) {
+ if (parse_lineno(last, &query->last_lineno) < 0)
+ return -EINVAL;
+
+ if (query->last_lineno < query->first_lineno) {
pr_err("last-line:%d < 1st-line:%d\n",
query->last_lineno,
query->first_lineno);
--
1.8.3.2
next prev parent reply other threads:[~2014-01-23 13:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-23 13:20 [PATCH 1/3] dynamic_debug: remove wrong error message Andrey Ryabinin
2014-01-23 13:20 ` Andrey Ryabinin [this message]
2014-01-23 13:20 ` [PATCH 3/3] dynamic_debug: replace obselete simple_strtoul() with kstrtouint() Andrey Ryabinin
2014-01-24 20:03 ` Jason Baron
2014-01-24 21:35 ` Greg KH
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=1390483232-7160-2-git-send-email-a.ryabinin@samsung.com \
--to=a.ryabinin@samsung.com \
--cc=jbaron@akamai.com \
--cc=linux-kernel@vger.kernel.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
all inboxes | Powered by JetHome®