linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Will Deacon <will@kernel.org>
To: kvmarm@lists.cs.columbia.edu
Cc: Will Deacon <will@kernel.org>, Marc Zyngier <maz@kernel.org>,
	Alexandru Elisei <alexandru.elisei@arm.com>,
	kernel-team@android.com, linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/6] KVM: arm64: Return error from kvm_arch_init_vm() on allocation failure
Date: Thu,  9 Jun 2022 13:12:18 +0100	[thread overview]
Message-ID: <20220609121223.2551-2-will@kernel.org> (raw)
In-Reply-To: <20220609121223.2551-1-will@kernel.org>

If we fail to allocate the 'supported_cpus' cpumask in kvm_arch_init_vm()
then be sure to return -ENOMEM instead of success (0) on the failure
path.

Reviewed-by: Alexandru Elisei <alexandru.elisei@arm.com>
Signed-off-by: Will Deacon <will@kernel.org>
---
 arch/arm64/kvm/arm.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c
index 400bb0fe2745..0da0f06037db 100644
--- a/arch/arm64/kvm/arm.c
+++ b/arch/arm64/kvm/arm.c
@@ -150,8 +150,10 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
 	if (ret)
 		goto out_free_stage2_pgd;
 
-	if (!zalloc_cpumask_var(&kvm->arch.supported_cpus, GFP_KERNEL))
+	if (!zalloc_cpumask_var(&kvm->arch.supported_cpus, GFP_KERNEL)) {
+		ret = -ENOMEM;
 		goto out_free_stage2_pgd;
+	}
 	cpumask_copy(kvm->arch.supported_cpus, cpu_possible_mask);
 
 	kvm_vgic_early_init(kvm);
-- 
2.36.1.255.ge46751e96f-goog


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2022-06-09 12:20 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-09 12:12 [PATCH 0/6] KVM/arm64: Minor/trivial fixes from pKVM mega-patch Will Deacon
2022-06-09 12:12 ` Will Deacon [this message]
2022-06-09 12:12 ` [PATCH 2/6] KVM: arm64: Handle all ID registers trapped for a protected VM Will Deacon
2022-06-14  5:57   ` Reiji Watanabe
2022-06-09 12:12 ` [PATCH 3/6] KVM: arm64: Ignore 'kvm-arm.mode=protected' when using VHE Will Deacon
2022-06-09 12:12 ` [PATCH 4/6] KVM: arm64: Extend comment in has_vhe() Will Deacon
2022-06-09 12:12 ` [PATCH 5/6] KVM: arm64: Remove redundant hyp_assert_lock_held() assertions Will Deacon
2022-06-09 12:12 ` [PATCH 6/6] KVM: arm64: Drop stale comment Will Deacon
2022-06-09 12:19 ` [PATCH 0/6] KVM/arm64: Minor/trivial fixes from pKVM mega-patch Marc Zyngier
2022-06-09 12:26 ` Marc Zyngier

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=20220609121223.2551-2-will@kernel.org \
    --to=will@kernel.org \
    --cc=alexandru.elisei@arm.com \
    --cc=kernel-team@android.com \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=maz@kernel.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 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).