linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Sean Christopherson <sean.j.christopherson@intel.com>
Cc: "Paul Mackerras" <paulus@ozlabs.org>,
	"Christian Borntraeger" <borntraeger@de.ibm.com>,
	"Janosch Frank" <frankja@linux.ibm.com>,
	"David Hildenbrand" <david@redhat.com>,
	"Cornelia Huck" <cohuck@redhat.com>,
	"Vitaly Kuznetsov" <vkuznets@redhat.com>,
	"Wanpeng Li" <wanpengli@tencent.com>,
	"Jim Mattson" <jmattson@google.com>,
	"Joerg Roedel" <joro@8bytes.org>, "Marc Zyngier" <maz@kernel.org>,
	"James Morse" <james.morse@arm.com>,
	"Julien Thierry" <julien.thierry.kdev@gmail.com>,
	"Suzuki K Poulose" <suzuki.poulose@arm.com>,
	linux-mips@vger.kernel.org, kvm@vger.kernel.org,
	kvm-ppc@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org,
	"Christoffer Dall" <christoffer.dall@arm.com>,
	"Peter Xu" <peterx@redhat.com>,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>
Subject: Re: [PATCH v6 14/22] KVM: Clean up local variable usage in __kvm_set_memory_region()
Date: Fri, 21 Feb 2020 18:43:34 +0100	[thread overview]
Message-ID: <1467b8cd-3631-b5da-b285-dbdf31b75af7@redhat.com> (raw)
In-Reply-To: <20200218210736.16432-15-sean.j.christopherson@intel.com>

On 18/02/20 22:07, Sean Christopherson wrote:
> -sorted by update_memslots(), and the old
>  	 * memslot needs to be referenced after calling update_memslots(), e.g.
> -	 * to free its resources and for arch specific behavior.
> +	 * to free its resources and for arch specific behavior.  Kill @tmp
> +	 * after making a copy to deter potentially dangerous usage.
>  	 */
> -	old = *slot;
> +	tmp = id_to_memslot(__kvm_memslots(kvm, as_id), id);
> +	old = *tmp;
> +	tmp = NULL;
> +

Also: old = *id_to_memslot(...).

Paolo


  reply	other threads:[~2020-02-21 17:43 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-18 21:07 [PATCH v6 00/22] KVM: Dynamically size memslot arrays Sean Christopherson
2020-02-18 21:07 ` [PATCH v6 01/22] KVM: x86: Allocate new rmap and large page tracking when moving memslot Sean Christopherson
2020-02-19 19:10   ` Peter Xu
2020-02-18 21:07 ` [PATCH v6 02/22] KVM: Reinstall old memslots if arch preparation fails Sean Christopherson
2020-02-18 21:07 ` [PATCH v6 03/22] KVM: Don't free new memslot if allocation of said memslot fails Sean Christopherson
2020-02-18 21:07 ` [PATCH v6 04/22] KVM: PPC: Move memslot memory allocation into prepare_memory_region() Sean Christopherson
2020-02-18 21:07 ` [PATCH v6 05/22] KVM: x86: Allocate memslot resources during prepare_memory_region() Sean Christopherson
2020-02-18 21:07 ` [PATCH v6 06/22] KVM: Drop kvm_arch_create_memslot() Sean Christopherson
2020-02-18 21:07 ` [PATCH v6 07/22] KVM: Explicitly free allocated-but-unused dirty bitmap Sean Christopherson
2020-02-18 21:07 ` [PATCH v6 08/22] KVM: Refactor error handling for setting memory region Sean Christopherson
2020-02-18 21:07 ` [PATCH v6 09/22] KVM: Move setting of memslot into helper routine Sean Christopherson
2020-02-18 21:07 ` [PATCH v6 10/22] KVM: Drop "const" attribute from old memslot in commit_memory_region() Sean Christopherson
2020-02-18 21:07 ` [PATCH v6 11/22] KVM: x86: Free arrays for old memslot when moving memslot's base gfn Sean Christopherson
2020-02-18 21:07 ` [PATCH v6 12/22] KVM: Move memslot deletion to helper function Sean Christopherson
2020-02-18 21:07 ` [PATCH v6 13/22] KVM: Simplify kvm_free_memslot() and all its descendents Sean Christopherson
2020-02-18 21:07 ` [PATCH v6 14/22] KVM: Clean up local variable usage in __kvm_set_memory_region() Sean Christopherson
2020-02-21 17:43   ` Paolo Bonzini [this message]
2020-02-18 21:07 ` [PATCH v6 15/22] KVM: Provide common implementation for generic dirty log functions Sean Christopherson
2020-02-18 21:07 ` [PATCH v6 16/22] KVM: Ensure validity of memslot with respect to kvm_get_dirty_log() Sean Christopherson
2020-02-18 21:07 ` [PATCH v6 17/22] KVM: Terminate memslot walks via used_slots Sean Christopherson
2020-02-21 17:47   ` Paolo Bonzini
2020-02-18 21:07 ` [PATCH v6 18/22] KVM: Dynamically size memslot array based on number of used slots Sean Christopherson
2020-02-18 21:07 ` [PATCH v6 19/22] KVM: selftests: Add test for KVM_SET_USER_MEMORY_REGION Sean Christopherson
2020-02-18 21:07 ` [PATCH v6 20/22] KVM: x86/mmu: Move kvm_arch_flush_remote_tlbs_memslot() to mmu.c Sean Christopherson
2020-02-18 21:07 ` [PATCH v6 21/22] KVM: x86/mmu: Use ranged-based TLB flush for dirty log memslot flush Sean Christopherson
2020-02-19  9:22   ` Sergei Shtylyov
2020-02-19 15:18     ` Sean Christopherson
2020-02-18 21:07 ` [PATCH v6 22/22] KVM: x86/mmu: Consolidate open coded variants of memslot TLB flushes Sean Christopherson

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=1467b8cd-3631-b5da-b285-dbdf31b75af7@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=borntraeger@de.ibm.com \
    --cc=christoffer.dall@arm.com \
    --cc=cohuck@redhat.com \
    --cc=david@redhat.com \
    --cc=f4bug@amsat.org \
    --cc=frankja@linux.ibm.com \
    --cc=james.morse@arm.com \
    --cc=jmattson@google.com \
    --cc=joro@8bytes.org \
    --cc=julien.thierry.kdev@gmail.com \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=maz@kernel.org \
    --cc=paulus@ozlabs.org \
    --cc=peterx@redhat.com \
    --cc=sean.j.christopherson@intel.com \
    --cc=suzuki.poulose@arm.com \
    --cc=vkuznets@redhat.com \
    --cc=wanpengli@tencent.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;
as well as URLs for NNTP newsgroup(s).