Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 323774
b: refs/heads/master
c: 245c5a1
h: refs/heads/master
v: v3
  • Loading branch information
Namhyung Kim authored and Arnaldo Carvalho de Melo committed Sep 7, 2012
1 parent bd2093c commit bfa94dc
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9a2936878a198553a17d21d1e843aa574ad9fa38
refs/heads/master: 245c5a18433090da0e1a799bdb0faa78552b5992
43 changes: 32 additions & 11 deletions trunk/tools/lib/traceevent/event-parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -3889,8 +3889,11 @@ static void pretty_print(struct trace_seq *s, void *data, int size, struct event
goto cont_process;
case '*':
/* The argument is the length. */
if (!arg)
die("no argument match");
if (!arg) {
do_warning("no argument match");
event->flags |= EVENT_FL_FAILED;
goto out_failed;
}
len_arg = eval_num_arg(data, size, event, arg);
len_as_arg = 1;
arg = arg->next;
Expand Down Expand Up @@ -3923,15 +3926,21 @@ static void pretty_print(struct trace_seq *s, void *data, int size, struct event
case 'x':
case 'X':
case 'u':
if (!arg)
die("no argument match");
if (!arg) {
do_warning("no argument match");
event->flags |= EVENT_FL_FAILED;
goto out_failed;
}

len = ((unsigned long)ptr + 1) -
(unsigned long)saveptr;

/* should never happen */
if (len > 31)
die("bad format!");
if (len > 31) {
do_warning("bad format!");
event->flags |= EVENT_FL_FAILED;
len = 31;
}

memcpy(format, saveptr, len);
format[len] = 0;
Expand Down Expand Up @@ -3995,19 +4004,26 @@ static void pretty_print(struct trace_seq *s, void *data, int size, struct event
trace_seq_printf(s, format, (long long)val);
break;
default:
die("bad count (%d)", ls);
do_warning("bad count (%d)", ls);
event->flags |= EVENT_FL_FAILED;
}
break;
case 's':
if (!arg)
die("no matching argument");
if (!arg) {
do_warning("no matching argument");
event->flags |= EVENT_FL_FAILED;
goto out_failed;
}

len = ((unsigned long)ptr + 1) -
(unsigned long)saveptr;

/* should never happen */
if (len > 31)
die("bad format!");
if (len > 31) {
do_warning("bad format!");
event->flags |= EVENT_FL_FAILED;
len = 31;
}

memcpy(format, saveptr, len);
format[len] = 0;
Expand All @@ -4025,6 +4041,11 @@ static void pretty_print(struct trace_seq *s, void *data, int size, struct event
trace_seq_putc(s, *ptr);
}

if (event->flags & EVENT_FL_FAILED) {
out_failed:
trace_seq_printf(s, "[FAILED TO PARSE]");
}

if (args) {
free_args(args);
free(bprint_fmt);
Expand Down

0 comments on commit bfa94dc

Please sign in to comment.