qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: Akihiko Odaki <akihiko.odaki@daynix.com>
Cc: qemu-devel@nongnu.org, qemu-arm@nongnu.org, kvm@vger.kernel.org,
	 Paolo Bonzini <pbonzini@redhat.com>,
	Richard Henderson <richard.henderson@linaro.org>
Subject: Re: [PATCH v5 5/6] accel/kvm: Free as when an error occurred
Date: Fri, 4 Aug 2023 18:30:41 +0100	[thread overview]
Message-ID: <CAFEAcA845sHzqVN_cZyvR69uhbfhTqsvWcdM4y9qFTv_pBmtnw@mail.gmail.com> (raw)
In-Reply-To: <20230727073134.134102-6-akihiko.odaki@daynix.com>

On Thu, 27 Jul 2023 at 08:31, Akihiko Odaki <akihiko.odaki@daynix.com> wrote:
>
> An error may occur after s->as is allocated, for example while
> determining KVM type.

That's about the one example you don't want to cite, because
it makes it sound like this is only a problem because
of a bug in the previous patch. In fact we already have
lots of 'goto err' paths after the allocation of s->as,
such as the one when kvm_ioctl(KVM_CREATE_VM) fails.

> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
> ---
>  accel/kvm/kvm-all.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
> index 94a62efa3c..4591669d78 100644
> --- a/accel/kvm/kvm-all.c
> +++ b/accel/kvm/kvm-all.c
> @@ -2765,6 +2765,7 @@ err:
>      if (s->fd != -1) {
>          close(s->fd);
>      }
> +    g_free(s->as);
>      g_free(s->memory_listener.slots);
>
>      return ret;

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM


  reply	other threads:[~2023-08-04 17:31 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-27  7:31 [PATCH v5 0/6] accel/kvm: Specify default IPA size for arm64 Akihiko Odaki
2023-07-27  7:31 ` [PATCH v5 1/6] kvm: Introduce kvm_arch_get_default_type hook Akihiko Odaki
2023-08-04 17:26   ` Peter Maydell
2023-08-04 17:38     ` Peter Maydell
2023-08-10  9:21       ` Philippe Mathieu-Daudé
2023-07-27  7:31 ` [PATCH v5 2/6] accel/kvm: Specify default IPA size for arm64 Akihiko Odaki
2023-08-04 17:32   ` Peter Maydell
2023-07-27  7:31 ` [PATCH v5 3/6] mips: Report an error when KVM_VM_MIPS_VZ is unavailable Akihiko Odaki
2023-08-04 17:27   ` Peter Maydell
2023-08-10  9:17   ` Philippe Mathieu-Daudé
2023-07-27  7:31 ` [PATCH v5 4/6] accel/kvm: Use negative KVM type for error propagation Akihiko Odaki
2023-08-04 17:28   ` Peter Maydell
2023-08-10  9:19   ` Philippe Mathieu-Daudé
2023-07-27  7:31 ` [PATCH v5 5/6] accel/kvm: Free as when an error occurred Akihiko Odaki
2023-08-04 17:30   ` Peter Maydell [this message]
2023-07-27  7:31 ` [PATCH v5 6/6] accel/kvm: Make kvm_dirty_ring_reaper_init() void Akihiko Odaki
2023-08-04 17:31   ` Peter Maydell
2023-08-10  9:18   ` Philippe Mathieu-Daudé
2023-08-04 17:41 ` [PATCH v5 0/6] accel/kvm: Specify default IPA size for arm64 Peter Maydell
2023-08-07 15:27   ` Peter Maydell

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=CAFEAcA845sHzqVN_cZyvR69uhbfhTqsvWcdM4y9qFTv_pBmtnw@mail.gmail.com \
    --to=peter.maydell@linaro.org \
    --cc=akihiko.odaki@daynix.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.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).