Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Alexandru Elisei <alexandru.elisei@arm.com>
To: will@kernel.org, julien.thierry.kdev@gmail.com,
	kvm@vger.kernel.org, maz@kernel.org, oupton@kernel.org,
	fuad.tabba@linux.dev, joey.gouly@arm.com, seiden@linux.ibm.com,
	suzuki.poulose@arm.com, yuzenghui@huawei.com,
	linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev
Subject: [PATCH kvmtool 1/7] arm64: Pass the number of elements as the first argument to calloc()
Date: Thu, 17 Sep 2026 16:49:26 +0100	[thread overview]
Message-ID: <20260917154932.193943-2-alexandru.elisei@arm.com> (raw)
In-Reply-To: <20260917154932.193943-1-alexandru.elisei@arm.com>

man 3 calloc is pretty clear that the first argument to calloc() is the
number of elements to be allocated, and the second argument is the size
of one element. Fix the instances where the order was inversed.

Signed-off-by: Alexandru Elisei <alexandru.elisei@arm.com>
---
 arm64/kvm.c | 2 +-
 arm64/pmu.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arm64/kvm.c b/arm64/kvm.c
index 36b3284e4a92..cdd673542aea 100644
--- a/arm64/kvm.c
+++ b/arm64/kvm.c
@@ -454,7 +454,7 @@ int vcpu_affinity_parser(const struct option *opt, const char *arg, int unset)
 
 	kvm->cfg.arch.vcpu_affinity = cpulist;
 
-	cpumask = calloc(1, cpumask_size());
+	cpumask = calloc(cpumask_size(), 1);
 	if (!cpumask)
 		die_perror("calloc");
 
diff --git a/arm64/pmu.c b/arm64/pmu.c
index ef7faca1b71d..49d58ddd529b 100644
--- a/arm64/pmu.c
+++ b/arm64/pmu.c
@@ -192,7 +192,7 @@ static int find_pmu(struct kvm *kvm)
 	cpumask_t *cpumask;
 	int i, this_cpu;
 
-	cpumask = calloc(1, cpumask_size());
+	cpumask = calloc(cpumask_size(), 1);
 	if (!cpumask)
 		die_perror("calloc");
 
-- 
2.55.0



  reply	other threads:[~2026-09-17 15:50 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-17 15:49 [PATCH kvmtool 0/7] Fix --vcpu-affinity Alexandru Elisei
2026-09-17 15:49 ` Alexandru Elisei [this message]
2026-09-17 15:49 ` [PATCH kvmtool 2/7] arm64: Consistently treat vcpu_affinity_cpuset as dynamically allocated Alexandru Elisei
2026-09-17 15:49 ` [PATCH kvmtool 3/7] arm64: Free the temporary cpumask in vcpu_affinity_parser() Alexandru Elisei
2026-09-17 15:49 ` [PATCH kvmtool 4/7] arm64/pmu: Consider kvmtool's affinity when searching for a PMU Alexandru Elisei
2026-09-17 15:49 ` [PATCH kvmtool 5/7] Correctly apply --vcpu-affinity to the VCPU threads Alexandru Elisei
2026-09-17 15:49 ` [RFC PATCH kvmtool 6/7] Introduce kvm_create_thread() Alexandru Elisei
2026-09-17 15:49 ` [RFC PATCH kvmtool 7/7] Don't apply --vcpu-affinity to threads spawned from VCPUs Alexandru Elisei
2026-09-18 12:22 ` [PATCH kvmtool 0/7] Fix --vcpu-affinity Marc Zyngier
2026-09-21  8:59   ` Alexandru Elisei

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=20260917154932.193943-2-alexandru.elisei@arm.com \
    --to=alexandru.elisei@arm.com \
    --cc=fuad.tabba@linux.dev \
    --cc=joey.gouly@arm.com \
    --cc=julien.thierry.kdev@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.linux.dev \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=maz@kernel.org \
    --cc=oupton@kernel.org \
    --cc=seiden@linux.ibm.com \
    --cc=suzuki.poulose@arm.com \
    --cc=will@kernel.org \
    --cc=yuzenghui@huawei.com \
    /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