From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org,
Arjun Sreedharan <arjun024@gmail.com>,
"Yann E. MORIN" <yann.morin.1998@free.fr>,
Ingo Molnar <mingo@redhat.com>, Paul Mackerras <paulus@samba.org>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 11/18] calloc/xcalloc: Fix argument order
Date: Thu, 11 Dec 2014 18:25:59 -0300 [thread overview]
Message-ID: <1418333166-15429-12-git-send-email-acme@kernel.org> (raw)
In-Reply-To: <1418333166-15429-1-git-send-email-acme@kernel.org>
From: Arjun Sreedharan <arjun024@gmail.com>
The calloc() and xcalloc() functions takes @nmemb first and then @size. Fix all w/
pattern "calloc\s*(\s*sizeof".
Signed-off-by: Arjun Sreedharan <arjun024@gmail.com>
Cc: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1417866043-1877-1-git-send-email-arjun024@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
scripts/kconfig/mconf.c | 4 ++--
tools/perf/ui/hist.c | 4 ++--
tools/thermal/tmon/sysfs.c | 6 +++---
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c
index 14cea7463a62..4dd37552abc2 100644
--- a/scripts/kconfig/mconf.c
+++ b/scripts/kconfig/mconf.c
@@ -330,10 +330,10 @@ static void set_subtitle(void)
list_for_each_entry(sp, &trail, entries) {
if (sp->text) {
if (pos) {
- pos->next = xcalloc(sizeof(*pos), 1);
+ pos->next = xcalloc(1, sizeof(*pos));
pos = pos->next;
} else {
- subtitles = pos = xcalloc(sizeof(*pos), 1);
+ subtitles = pos = xcalloc(1, sizeof(*pos));
}
pos->text = sp->text;
}
diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c
index 2af18376b077..dc0d095f318c 100644
--- a/tools/perf/ui/hist.c
+++ b/tools/perf/ui/hist.c
@@ -162,8 +162,8 @@ static int __hpp__sort(struct hist_entry *a, struct hist_entry *b,
return ret;
nr_members = evsel->nr_members;
- fields_a = calloc(sizeof(*fields_a), nr_members);
- fields_b = calloc(sizeof(*fields_b), nr_members);
+ fields_a = calloc(nr_members, sizeof(*fields_a));
+ fields_b = calloc(nr_members, sizeof(*fields_b));
if (!fields_a || !fields_b)
goto out;
diff --git a/tools/thermal/tmon/sysfs.c b/tools/thermal/tmon/sysfs.c
index dfe454855cd2..1c12536f2081 100644
--- a/tools/thermal/tmon/sysfs.c
+++ b/tools/thermal/tmon/sysfs.c
@@ -446,7 +446,7 @@ int probe_thermal_sysfs(void)
return -1;
}
- ptdata.tzi = calloc(sizeof(struct tz_info), ptdata.max_tz_instance+1);
+ ptdata.tzi = calloc(ptdata.max_tz_instance+1, sizeof(struct tz_info));
if (!ptdata.tzi) {
fprintf(stderr, "Err: allocate tz_info\n");
return -1;
@@ -454,8 +454,8 @@ int probe_thermal_sysfs(void)
/* we still show thermal zone information if there is no cdev */
if (ptdata.nr_cooling_dev) {
- ptdata.cdi = calloc(sizeof(struct cdev_info),
- ptdata.max_cdev_instance + 1);
+ ptdata.cdi = calloc(ptdata.max_cdev_instance + 1,
+ sizeof(struct cdev_info));
if (!ptdata.cdi) {
free(ptdata.tzi);
fprintf(stderr, "Err: allocate cdev_info\n");
--
1.9.3
next prev parent reply other threads:[~2014-12-11 21:29 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-11 21:25 [GIT PULL 00/18] perf/core improvements and fixes Arnaldo Carvalho de Melo
2014-12-11 21:25 ` [PATCH 01/18] perf bench: Prepare memcpy for merge Arnaldo Carvalho de Melo
2014-12-11 21:25 ` [PATCH 02/18] perf bench: Merge memset into memcpy Arnaldo Carvalho de Melo
2014-12-11 21:25 ` [PATCH 03/18] perf bench: Fix memcpy/memset output Arnaldo Carvalho de Melo
2014-12-11 21:25 ` [PATCH 04/18] perf hists browser: Change print format from %lu to %PRIu64 Arnaldo Carvalho de Melo
2014-12-11 21:25 ` [PATCH 05/18] perf tools: Use single strcmp call instead of two Arnaldo Carvalho de Melo
2014-12-11 21:25 ` [PATCH 06/18] perf buildid-cache: Remove extra debugdir variables Arnaldo Carvalho de Melo
2014-12-11 21:25 ` [PATCH 07/18] perf buildid cache: Fix -a segfault related to kcore handling Arnaldo Carvalho de Melo
2014-12-11 21:25 ` [PATCH 08/18] perf tools: Add --buildid-dir option to set cache directory Arnaldo Carvalho de Melo
2014-12-11 21:25 ` [PATCH 09/18] perf callchain: Fixup parameter handling error message Arnaldo Carvalho de Melo
2014-12-11 21:25 ` [PATCH 10/18] perf callchain: Move cpumode resolve code to add_callchain_ip Arnaldo Carvalho de Melo
2014-12-11 21:25 ` Arnaldo Carvalho de Melo [this message]
2014-12-11 21:26 ` [PATCH 12/18] perf tests: Fix attr tests size values to cope with machine state on interrupt ABI changes Arnaldo Carvalho de Melo
2014-12-11 21:26 ` [PATCH 13/18] perf kvm stat live: Mark events as (x86 only) in help output Arnaldo Carvalho de Melo
2014-12-11 21:26 ` [PATCH 14/18] tools lib fs: Adopt filename__read_int from tools/perf/ Arnaldo Carvalho de Melo
2014-12-11 21:26 ` [PATCH 15/18] tools lib fs: Add sysctl__read_int helper Arnaldo Carvalho de Melo
2014-12-11 21:26 ` [PATCH 16/18] perf tools: Use sysctl__read_int instead of ad-hoc copies Arnaldo Carvalho de Melo
2014-12-11 21:26 ` [PATCH 17/18] perf evlist: Introduce strerror_mmap method Arnaldo Carvalho de Melo
2014-12-11 21:26 ` [PATCH 18/18] perf trace: Provide a better explanation when mmap fails Arnaldo Carvalho de Melo
2014-12-12 8:10 ` [GIT PULL 00/18] perf/core improvements and fixes Ingo Molnar
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=1418333166-15429-12-git-send-email-acme@kernel.org \
--to=acme@kernel.org \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@redhat.com \
--cc=arjun024@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=mingo@redhat.com \
--cc=paulus@samba.org \
--cc=yann.morin.1998@free.fr \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).