From: sashiko-bot@kernel.org
To: "Claudio Imbrenda" <imbrenda@linux.ibm.com>
Cc: linux-s390@vger.kernel.org, "Vasily Gorbik" <gor@linux.ibm.com>,
"Alexander Gordeev" <agordeev@linux.ibm.com>,
kvm@vger.kernel.org, "Heiko Carstens" <hca@linux.ibm.com>
Subject: Re: [PATCH v3 08/10] KVM: s390: Free the mmu cache when kvm_arch_vcpu_create() fails
Date: Mon, 27 Jul 2026 17:06:52 +0000 [thread overview]
Message-ID: <20260727170652.A69FB1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260727150254.236021-9-imbrenda@linux.ibm.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Mixing goto-based error handling with scope-based cleanup (__free) in the same function.
--
--- Patch [8]: [PATCH v3 08/10] KVM: s390: Free the mmu cache when kvm_arch_vcpu_create() fails ---
commit f957b5e2634eaa5f53bf929349c916ffa15d9f2c
Author: Claudio Imbrenda <imbrenda@linux.ibm.com>
KVM: s390: Free the mmu cache when kvm_arch_vcpu_create() fails
This commit switches kvm_arch_vcpu_create() to use the __free()
scope-based cleanup helper for the mmu cache to prevent memory leaks
during initialization failures.
> diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
> --- a/arch/s390/kvm/kvm-s390.c
> +++ b/arch/s390/kvm/kvm-s390.c
> @@ -3794,19 +3794,17 @@ int kvm_arch_vcpu_precreate(struct kvm *kvm, unsigned int id)
>
> int kvm_arch_vcpu_create(struct kvm_vcpu *vcpu)
> {
> + struct kvm_s390_mmu_cache *mc __free(kvm_s390_mmu_cache) = NULL;
> struct sie_page *sie_page;
> int rc;
[ ... ]
> @@ -3862,6 +3860,8 @@ int kvm_arch_vcpu_create(struct kvm_vcpu *vcpu)
> if (rc)
> goto out_ucontrol_uninit;
>
[Severity: Low]
Are we permitted to mix scope-based cleanup and goto-based error handling
in the same function?
The cleanup guidelines indicate that for a given routine, we should generally
convert all resources that need a goto cleanup to scope-based cleanup, or
convert none of them. Mixing __free() with existing goto paths can create
confusing ownership semantics during future refactoring.
Could we either convert out_ucontrol_uninit and out_free_sie_block to use
scope-based cleanup as well, or stick to traditional goto labels for freeing
the mmu cache?
> + vcpu->arch.mc = mc;
> + mc = NULL;
> kvm_s390_update_topology_change_report(vcpu->kvm, 1);
> return 0;
>
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260727150254.236021-1-imbrenda@linux.ibm.com?part=8
next prev parent reply other threads:[~2026-07-27 17:06 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-27 15:02 [PATCH v3 00/10] KVM: s390: Misc fixes Claudio Imbrenda
2026-07-27 15:02 ` [PATCH v3 01/10] KVM: s390: Fix unlikely NULL gmap dereference Claudio Imbrenda
2026-07-27 15:24 ` sashiko-bot
2026-07-27 15:02 ` [PATCH v3 02/10] KVM: s390: Fix leaking of PGM_ADDRESSING to userspace Claudio Imbrenda
2026-07-27 15:33 ` sashiko-bot
2026-07-27 15:02 ` [PATCH v3 03/10] KVM: s390: Fix race in __do_essa() Claudio Imbrenda
2026-07-27 15:43 ` sashiko-bot
2026-07-27 15:02 ` [PATCH v3 04/10] KVM: s390: cmma: Fix dirty tracking when removing memslot Claudio Imbrenda
2026-07-27 16:03 ` sashiko-bot
2026-07-27 15:02 ` [PATCH v3 05/10] KVM: s390: ucontrol: Add missing locking around gmap_remove_child() Claudio Imbrenda
2026-07-27 16:14 ` sashiko-bot
2026-07-27 15:02 ` [PATCH v3 06/10] KVM: s390: Fix overclearing ESCA in case of error Claudio Imbrenda
2026-07-27 16:33 ` sashiko-bot
2026-07-27 15:02 ` [PATCH v3 07/10] KVM: s390: Return -EINTR if a signal was pending while faulting-in Claudio Imbrenda
2026-07-27 16:59 ` sashiko-bot
2026-07-27 15:02 ` [PATCH v3 08/10] KVM: s390: Free the mmu cache when kvm_arch_vcpu_create() fails Claudio Imbrenda
2026-07-27 17:06 ` sashiko-bot [this message]
2026-07-27 15:02 ` [PATCH v3 09/10] KVM: s390: Fix ordering when adding to SCA Claudio Imbrenda
2026-07-27 17:12 ` sashiko-bot
2026-07-27 15:02 ` [PATCH v3 10/10] KVM: s390: Fix cleanup in kvm_s390_pv_create_cpu() Claudio Imbrenda
2026-07-27 17:18 ` sashiko-bot
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=20260727170652.A69FB1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=agordeev@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=imbrenda@linux.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.