From: walter harms <wharms@bfs.de>
To: Julia Lawall <julia@diku.dk>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>,
Paul Mackerras <paulus@samba.org>, Ingo Molnar <mingo@elte.hu>,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH 4/5] tools/perf/util: correct size computation
Date: Mon, 07 Dec 2009 10:08:15 +0000 [thread overview]
Message-ID: <4B1CD40F.4010407@bfs.de> (raw)
In-Reply-To: <Pine.LNX.4.64.0912061016120.20858@ask.diku.dk>
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
WARNING: multiple messages have this Message-ID (diff)
From: walter harms <wharms@bfs.de>
To: Julia Lawall <julia@diku.dk>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>,
Paul Mackerras <paulus@samba.org>, Ingo Molnar <mingo@elte.hu>,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH 4/5] tools/perf/util: correct size computation
Date: Mon, 07 Dec 2009 11:08:15 +0100 [thread overview]
Message-ID: <4B1CD40F.4010407@bfs.de> (raw)
In-Reply-To: <Pine.LNX.4.64.0912061016120.20858@ask.diku.dk>
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
next prev parent reply other threads:[~2009-12-07 10:08 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-06 9:16 [PATCH 4/5] tools/perf/util: correct size computation Julia Lawall
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 ` walter harms [this message]
2009-12-07 10:08 ` [PATCH 4/5] tools/perf/util: correct size computation walter harms
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4B1CD40F.4010407@bfs.de \
--to=wharms@bfs.de \
--cc=a.p.zijlstra@chello.nl \
--cc=julia@diku.dk \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=paulus@samba.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.