Skip to content

Commit 7f6e1f3

Browse files
committed
Revert "dyndbg: fix problem parsing format="foo bar""
This reverts commit 42f0781 as it still causes problems. It will be resolved later, let's revert it so we can also revert the original patch this was supposed to be helping with. Reported-by: Naresh Kamboju <naresh.kamboju@linaro.org> Fixes: 42f0781 ("dyndbg: fix problem parsing format="foo bar"") Cc: Jim Cromie <jim.cromie@gmail.com> Cc: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 162343a commit 7f6e1f3

File tree

1 file changed

+21
-17
lines changed

1 file changed

+21
-17
lines changed

lib/dynamic_debug.c

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,6 @@ static int ddebug_tokenize(char *buf, char *words[], int maxwords)
237237
{
238238
int nwords = 0;
239239

240-
vpr_info("entry, buf:'%s'\n", buf);
241240
while (*buf) {
242241
char *end;
243242

@@ -248,8 +247,6 @@ static int ddebug_tokenize(char *buf, char *words[], int maxwords)
248247
if (*buf == '#')
249248
break; /* token starts comment, skip rest of line */
250249

251-
vpr_info("start-of-word:%d '%s'\n", nwords, buf);
252-
253250
/* find `end' of word, whitespace separated or quoted */
254251
if (*buf == '"' || *buf == '\'') {
255252
int quote = *buf++;
@@ -260,9 +257,7 @@ static int ddebug_tokenize(char *buf, char *words[], int maxwords)
260257
return -EINVAL; /* unclosed quote */
261258
}
262259
} else {
263-
for (end = buf;
264-
*end && *end != '=' && !isspace(*end);
265-
end++)
260+
for (end = buf; *end && !isspace(*end); end++)
266261
;
267262
BUG_ON(end == buf);
268263
}
@@ -378,21 +373,30 @@ static int ddebug_parse_query(char *words[], int nwords,
378373
unsigned int i;
379374
int rc = 0;
380375
char *fline;
376+
char *keyword, *arg;
381377

382-
if (nwords % 2 != 0) {
383-
pr_err("expecting pairs of match-spec <value>\n");
384-
return -EINVAL;
385-
}
386-
if (modname) {
378+
if (modname)
387379
/* support $modname.dyndbg=<multiple queries> */
388-
vpr_info("module:%s queries:'%s'\n", modname);
389380
query->module = modname;
390-
}
391-
for (i = 0; i < nwords; i += 2) {
392-
char *keyword = words[i];
393-
char *arg = words[i+1];
394381

395-
vpr_info("keyword:'%s' value:'%s'\n", keyword, arg);
382+
for (i = 0; i < nwords; i++) {
383+
/* accept keyword=arg */
384+
vpr_info("%d w:%s\n", i, words[i]);
385+
386+
keyword = words[i];
387+
arg = strchr(keyword, '=');
388+
if (arg) {
389+
*arg++ = '\0';
390+
} else {
391+
i++; /* next word is arg */
392+
if (!(i < nwords)) {
393+
pr_err("missing arg to keyword: %s\n", keyword);
394+
return -EINVAL;
395+
}
396+
arg = words[i];
397+
}
398+
vpr_info("%d key:%s arg:%s\n", i, keyword, arg);
399+
396400
if (!strcmp(keyword, "func")) {
397401
rc = check_set(&query->function, arg, "func");
398402
} else if (!strcmp(keyword, "file")) {

0 commit comments

Comments
 (0)