Skip to content

Commit

Permalink
dynamic_debug: fix ddebug_parse_query()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Cc: Jason Baron <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
aryabinin authored and torvalds committed Jan 28, 2014
1 parent d9e133e commit 3ace678
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/dynamic_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 3ace678

Please sign in to comment.