提交 3ace678f 编写于 作者: A Andrey Ryabinin 提交者: 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: NAndrey Ryabinin <a.ryabinin@samsung.com>
Cc: Jason Baron <jbaron@akamai.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册