kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oliver Upton <oupton@google.com>
To: kvm@vger.kernel.org
Cc: Paolo Bonzini <pbonzini@redhat.com>, Oliver Upton <oupton@google.com>
Subject: [PATCH] KVM: Suppress warning in __kvm_gfn_to_hva_cache_init
Date: Tue, 18 Feb 2020 10:47:56 -0800	[thread overview]
Message-ID: <20200218184756.242904-1-oupton@google.com> (raw)

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


             reply	other threads:[~2020-02-18 18:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-18 18:47 Oliver Upton [this message]
2020-02-18 19:07 ` [PATCH] KVM: Suppress warning in __kvm_gfn_to_hva_cache_init 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

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=20200218184756.242904-1-oupton@google.com \
    --to=oupton@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.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).