diff options
author | Julia Lawall <julia@diku.dk> | 2009-12-09 14:26:18 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-12-10 02:30:26 -0500 |
commit | 5660ce34241ab204bf78fbcaa5e09318c2748d37 (patch) | |
tree | e1b8529e702fafd53e0097b5250edb578a23b396 /tools | |
parent | 21140f4d3387aa2213f1deea0128df1dbf924379 (diff) |
perf tools: Correct size given to memset
Memset should be given the size of the structure, not the size
of the pointer.
The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@@
type T;
T *x;
expression E;
@@
memset(x, E, sizeof(
+ *
x))
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <Pine.LNX.4.64.0912092026000.1870@ask.diku.dk>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/util/probe-event.c | 2 | ||||
-rw-r--r-- | tools/perf/util/trace-event-parse.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c index 9480d9941cc0..d14a4585bcaf 100644 --- a/tools/perf/util/probe-event.c +++ b/tools/perf/util/probe-event.c | |||
@@ -376,7 +376,7 @@ static void clear_probe_point(struct probe_point *pp) | |||
376 | free(pp->args); | 376 | free(pp->args); |
377 | for (i = 0; i < pp->found; i++) | 377 | for (i = 0; i < pp->found; i++) |
378 | free(pp->probes[i]); | 378 | free(pp->probes[i]); |
379 | memset(pp, 0, sizeof(pp)); | 379 | memset(pp, 0, sizeof(*pp)); |
380 | } | 380 | } |
381 | 381 | ||
382 | /* Show an event */ | 382 | /* Show an event */ |
diff --git a/tools/perf/util/trace-event-parse.c b/tools/perf/util/trace-event-parse.c index 6ffe9d63d85d..c5c32be040bf 100644 --- a/tools/perf/util/trace-event-parse.c +++ b/tools/perf/util/trace-event-parse.c | |||
@@ -1477,7 +1477,7 @@ process_fields(struct event *event, struct print_flag_sym **list, char **tok) | |||
1477 | goto out_free; | 1477 | goto out_free; |
1478 | 1478 | ||
1479 | field = malloc_or_die(sizeof(*field)); | 1479 | field = malloc_or_die(sizeof(*field)); |
1480 | memset(field, 0, sizeof(field)); | 1480 | memset(field, 0, sizeof(*field)); |
1481 | 1481 | ||
1482 | value = arg_eval(arg); | 1482 | value = arg_eval(arg); |
1483 | field->value = strdup(value); | 1483 | field->value = strdup(value); |