Skip to contentSkip to conversation

dynamic-debug-howto: fix optional/omitted ending line number to be LARGE instead of 0

PATCH New [email protected] 1 participant 1 message Nov 17, 2017

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

PATCH 24/94 dynamic-debug-howto: fix optional/omitted ending line number to be LARGE instead of 0

From: Randy Dunlap <[email protected]>
Subject: dynamic-debug-howto: fix optional/omitted ending line number to be LARGE instead of 0

line-range is supposed to treat "1-" as "1-endoffile", so handle the special case by setting last_lineno to UINT_MAX.

Fixes this error:

dynamic_debug:ddebug_parse_query: last-line:0 < 1st-line:1 dynamic_debug:ddebug_exec_query: query parse failed

---

 lib/dynamic_debug.c |    4 ++++
 1 file changed, 4 insertions(+)
lib/dynamic_debug.c renamed from lib/dynamic_debug.c~dynamic_debug-fix-optional-omitted-ending-line-number-to-be-large-instead-of-0 +4 -0
diff -puN lib/dynamic_debug.c~dynamic_debug-fix-optional-omitted-ending-line-number-to-be-large-instead-of-0 lib/dynamic_debug.c
@@ -360,6 +360,10 @@ static int ddebug_parse_query(char *word
 				if (parse_lineno(last, &query->last_lineno) < 0)
 					return -EINVAL;
 
+				/* special case for last lineno not specified */
+				if (query->last_lineno == 0)
+					query->last_lineno = UINT_MAX;
+
 				if (query->last_lineno < query->first_lineno) {
 					pr_err("last-line:%d < 1st-line:%d\n",
 						query->last_lineno,

_