Commit 59b4caeb authored by Julia Lawall's avatar Julia Lawall Committed by Ingo Molnar

perf tools: Correct size computation in tracepoint_id_to_path()

The size argument to zalloc should be the size of desired
structure, not the pointer to it.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@expression@
expression *x;
@@

x =
 <+...
-sizeof(x)
+sizeof(*x)
...+>// </smpl>
Signed-off-by: default avatarJulia Lawall <julia@diku.dk>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <Pine.LNX.4.64.0912061016120.20858@ask.diku.dk>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent af2d8289
...@@ -197,7 +197,7 @@ struct tracepoint_path *tracepoint_id_to_path(u64 config) ...@@ -197,7 +197,7 @@ struct tracepoint_path *tracepoint_id_to_path(u64 config)
if (id == config) { if (id == config) {
closedir(evt_dir); closedir(evt_dir);
closedir(sys_dir); closedir(sys_dir);
path = zalloc(sizeof(path)); path = zalloc(sizeof(*path));
path->system = malloc(MAX_EVENT_LENGTH); path->system = malloc(MAX_EVENT_LENGTH);
if (!path->system) { if (!path->system) {
free(path); free(path);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment