Commit 3ace678f authored by Andrey Ryabinin's avatar Andrey Ryabinin Committed by Linus Torvalds

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: default avatarAndrey Ryabinin <a.ryabinin@samsung.com>
Cc: Jason Baron <jbaron@akamai.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent d9e133e6
...@@ -352,8 +352,10 @@ static int ddebug_parse_query(char *words[], int nwords, ...@@ -352,8 +352,10 @@ static int ddebug_parse_query(char *words[], int nwords,
return -EINVAL; return -EINVAL;
if (last) { if (last) {
/* range <first>-<last> */ /* range <first>-<last> */
if (parse_lineno(last, &query->last_lineno) if (parse_lineno(last, &query->last_lineno) < 0)
< query->first_lineno) { return -EINVAL;
if (query->last_lineno < query->first_lineno) {
pr_err("last-line:%d < 1st-line:%d\n", pr_err("last-line:%d < 1st-line:%d\n",
query->last_lineno, query->last_lineno,
query->first_lineno); query->first_lineno);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment