* [PATCH 4/5] tools/perf/util: correct size computation
@ 2009-12-06 9:16 Julia Lawall
2009-12-06 9:24 ` [tip:perf/urgent] perf tools: Correct size computation in tracepoint_id_to_path() tip-bot for Julia Lawall
2009-12-07 10:08 ` [PATCH 4/5] tools/perf/util: correct size computation walter harms
0 siblings, 2 replies; 3+ messages in thread
From: Julia Lawall @ 2009-12-06 9:16 UTC (permalink / raw)
To: Peter Zijlstra, Paul Mackerras, Ingo Molnar, linux-kernel,
kernel-janitors
From: Julia Lawall <julia@diku.dk>
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: Julia Lawall <julia@diku.dk>
---
tools/perf/util/parse-events.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff -u -p a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -197,7 +197,7 @@ struct tracepoint_path *tracepoint_id_to
if (id == config) {
closedir(evt_dir);
closedir(sys_dir);
- path = zalloc(sizeof(path));
+ path = zalloc(sizeof(*path));
path->system = malloc(MAX_EVENT_LENGTH);
if (!path->system) {
free(path);
^ permalink raw reply [flat|nested] 3+ messages in thread
* [tip:perf/urgent] perf tools: Correct size computation in tracepoint_id_to_path()
2009-12-06 9:16 [PATCH 4/5] tools/perf/util: correct size computation Julia Lawall
@ 2009-12-06 9:24 ` tip-bot for Julia Lawall
2009-12-07 10:08 ` [PATCH 4/5] tools/perf/util: correct size computation walter harms
1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Julia Lawall @ 2009-12-06 9:24 UTC (permalink / raw)
To: linux-tip-commits
Cc: linux-kernel, acme, paulus, julia, hpa, mingo, a.p.zijlstra,
efault, fweisbec, tglx, mingo
Commit-ID: 59b4caeb797494043f5f3b98a610f5d9b75eefa3
Gitweb: http://git.kernel.org/tip/59b4caeb797494043f5f3b98a610f5d9b75eefa3
Author: Julia Lawall <julia@diku.dk>
AuthorDate: Sun, 6 Dec 2009 10:16:30 +0100
Committer: Ingo Molnar <mingo@elte.hu>
CommitDate: Sun, 6 Dec 2009 10:21:59 +0100
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: Julia 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: Ingo Molnar <mingo@elte.hu>
---
tools/perf/util/parse-events.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 9e5dbd6..448a13b 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -197,7 +197,7 @@ struct tracepoint_path *tracepoint_id_to_path(u64 config)
if (id == config) {
closedir(evt_dir);
closedir(sys_dir);
- path = zalloc(sizeof(path));
+ path = zalloc(sizeof(*path));
path->system = malloc(MAX_EVENT_LENGTH);
if (!path->system) {
free(path);
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 4/5] tools/perf/util: correct size computation
2009-12-06 9:16 [PATCH 4/5] tools/perf/util: correct size computation Julia Lawall
2009-12-06 9:24 ` [tip:perf/urgent] perf tools: Correct size computation in tracepoint_id_to_path() tip-bot for Julia Lawall
@ 2009-12-07 10:08 ` walter harms
1 sibling, 0 replies; 3+ messages in thread
From: walter harms @ 2009-12-07 10:08 UTC (permalink / raw)
To: Julia Lawall
Cc: Peter Zijlstra, Paul Mackerras, Ingo Molnar, linux-kernel,
kernel-janitors
Julia Lawall schrieb:
> From: Julia Lawall <julia@diku.dk>
>
> 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: Julia Lawall <julia@diku.dk>
>
> ---
> tools/perf/util/parse-events.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff -u -p a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
> --- a/tools/perf/util/parse-events.c
> +++ b/tools/perf/util/parse-events.c
> @@ -197,7 +197,7 @@ struct tracepoint_path *tracepoint_id_to
> if (id == config) {
> closedir(evt_dir);
> closedir(sys_dir);
> - path = zalloc(sizeof(path));
> + path = zalloc(sizeof(*path));
> path->system = malloc(MAX_EVENT_LENGTH);
> if (!path->system) {
> free(path);
and zalloc() can not fail ?
re,
wh
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-12-07 10:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-06 9:16 [PATCH 4/5] tools/perf/util: correct size computation Julia Lawall
2009-12-06 9:24 ` [tip:perf/urgent] perf tools: Correct size computation in tracepoint_id_to_path() tip-bot for Julia Lawall
2009-12-07 10:08 ` [PATCH 4/5] tools/perf/util: correct size computation walter harms
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox