kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] KVM: Suppress warning in __kvm_gfn_to_hva_cache_init
@ 2020-02-18 18:47 Oliver Upton
  2020-02-18 19:07 ` Sean Christopherson
  0 siblings, 1 reply; 9+ messages in thread
From: Oliver Upton @ 2020-02-18 18:47 UTC (permalink / raw)
  To: kvm; +Cc: Paolo Bonzini, Oliver Upton

Particularly draconian compilers warn of a possible uninitialized use of
the nr_pages_avail variable. Silence this warning by initializing it to
zero.

Signed-off-by: Oliver Upton <oupton@google.com>
---
 virt/kvm/kvm_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 70f03ce0e5c1..dc8a67ad082d 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -2219,7 +2219,7 @@ static int __kvm_gfn_to_hva_cache_init(struct kvm_memslots *slots,
 	gfn_t start_gfn = gpa >> PAGE_SHIFT;
 	gfn_t end_gfn = (gpa + len - 1) >> PAGE_SHIFT;
 	gfn_t nr_pages_needed = end_gfn - start_gfn + 1;
-	gfn_t nr_pages_avail;
+	gfn_t nr_pages_avail = 0;
 
 	/* Update ghc->generation before performing any error checks. */
 	ghc->generation = slots->generation;
-- 
2.25.0.265.gbab2e86ba0-goog


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-02-21  9:05 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-02-18 18:47 [PATCH] KVM: Suppress warning in __kvm_gfn_to_hva_cache_init Oliver Upton
2020-02-18 19:07 ` Sean Christopherson
2020-02-18 21:34   ` Oliver Upton
2020-02-18 22:21     ` Sean Christopherson
2020-02-20 11:22   ` Paolo Bonzini
2020-02-21  4:32     ` Oliver Upton
2020-02-21  8:24       ` Paolo Bonzini
2020-02-21  8:34         ` Oliver Upton
2020-02-21  9:05           ` Paolo Bonzini

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