diff options
author | Paul Gortmaker <paul.gortmaker@windriver.com> | 2013-01-30 20:05:49 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-02-06 16:09:28 -0500 |
commit | 91b988048bea24eae386da3141d247ccea795a81 (patch) | |
tree | 7282e2e9a39fb33c29dea52c1d5f8429c3d40a3c /tools/perf | |
parent | 5a30a99fb4bb4c9374ea122a2a7c9cd9d26ecdd6 (diff) |
perf tools: Fix calloc argument ordering
A sweep of the kernel for regex "kcalloc(sizeof" turned up 2 reversed
args, fixed in commit d3d09e18203dba16a9dbdb2b4cc673d90748cdd1 ("EDAC:
Fix kcalloc argument order") and also fixed in the networking commit
a1b1add07fa794974573d93483d68e373edfe7bd ("gro: Fix kcalloc argument
order").
I know that was the regex used, because on seeing the 1st of these
changes, I wondered "how many other instances of this are there" and I
happened to just use "calloc(sizeof" as a regex and it in turn found
these additional reversed args instances in the perf code.
In the kcalloc cases, the changes are cosmetic, since the numbers are
simply multiplied. I had no desire to go data mining in userspace to
see if the same thing held true there, however.
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Joe Perches <joe@perches.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1359594349-25912-1-git-send-email-paul.gortmaker@windriver.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf')
-rw-r--r-- | tools/perf/util/callchain.c | 2 | ||||
-rw-r--r-- | tools/perf/util/header.c | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c index d3b3f5d82137..42b6a632fe7b 100644 --- a/tools/perf/util/callchain.c +++ b/tools/perf/util/callchain.c | |||
@@ -444,7 +444,7 @@ int callchain_cursor_append(struct callchain_cursor *cursor, | |||
444 | struct callchain_cursor_node *node = *cursor->last; | 444 | struct callchain_cursor_node *node = *cursor->last; |
445 | 445 | ||
446 | if (!node) { | 446 | if (!node) { |
447 | node = calloc(sizeof(*node), 1); | 447 | node = calloc(1, sizeof(*node)); |
448 | if (!node) | 448 | if (!node) |
449 | return -ENOMEM; | 449 | return -ENOMEM; |
450 | 450 | ||
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c index 8022b5254f75..f4bfd79ef6a7 100644 --- a/tools/perf/util/header.c +++ b/tools/perf/util/header.c | |||
@@ -2253,7 +2253,7 @@ static int perf_header__adds_write(struct perf_header *header, | |||
2253 | if (!nr_sections) | 2253 | if (!nr_sections) |
2254 | return 0; | 2254 | return 0; |
2255 | 2255 | ||
2256 | feat_sec = p = calloc(sizeof(*feat_sec), nr_sections); | 2256 | feat_sec = p = calloc(nr_sections, sizeof(*feat_sec)); |
2257 | if (feat_sec == NULL) | 2257 | if (feat_sec == NULL) |
2258 | return -ENOMEM; | 2258 | return -ENOMEM; |
2259 | 2259 | ||
@@ -2425,7 +2425,7 @@ int perf_header__process_sections(struct perf_header *header, int fd, | |||
2425 | if (!nr_sections) | 2425 | if (!nr_sections) |
2426 | return 0; | 2426 | return 0; |
2427 | 2427 | ||
2428 | feat_sec = sec = calloc(sizeof(*feat_sec), nr_sections); | 2428 | feat_sec = sec = calloc(nr_sections, sizeof(*feat_sec)); |
2429 | if (!feat_sec) | 2429 | if (!feat_sec) |
2430 | return -1; | 2430 | return -1; |
2431 | 2431 | ||