diff options
author | Andrey Ryabinin <a.ryabinin@samsung.com> | 2014-01-28 05:06:58 +0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-01-28 09:02:39 +0400 |
commit | 3ace678fd1b246b75e01eeac0554de35656136a4 (patch) | |
tree | 81db6091116b988123782988a37f8eadb4b4c55c /lib/dynamic_debug.c | |
parent | d9e133e6f05fbb39e2ecf7bc1edca299729a8595 (diff) | |
download | linux-3ace678fd1b246b75e01eeac0554de35656136a4.tar.xz |
dynamic_debug: fix ddebug_parse_query()
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>
Cc: Jason Baron <jbaron@akamai.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'lib/dynamic_debug.c')
-rw-r--r-- | lib/dynamic_debug.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index f959c39cc007..e488d9a03adc 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); |