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 --- 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