From: Andrey Ryabinin Date: Tue, 28 Jan 2014 01:06:58 +0000 (-0800) Subject: dynamic_debug: fix ddebug_parse_query() X-Git-Tag: submit/tizen/20160422.055611~1^2~99^2~18^2~2305^2~22 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3ace678fd1b246b75e01eeac0554de35656136a4;p=sdk%2Femulator%2Femulator-kernel.git 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 Cc: Jason Baron Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- 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 - */ - 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);