kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC][PATCH 1/2] kvm: x86: mmu: return zero if s > e in rsvd_bits()
@ 2014-11-14  9:31 Tiejun Chen
  2014-11-14  9:31 ` [RFC][PATCH 2/2] kvm: x86: mmio: fix setting the present bit of mmio spte Tiejun Chen
  2014-11-14 10:06 ` [RFC][PATCH 1/2] kvm: x86: mmu: return zero if s > e in rsvd_bits() Paolo Bonzini
  0 siblings, 2 replies; 8+ messages in thread
From: Tiejun Chen @ 2014-11-14  9:31 UTC (permalink / raw)
  To: pbonzini; +Cc: kvm

In some real scenarios 'start' may not be less than 'end' like
maxphyaddr = 52.

Signed-off-by: Tiejun Chen <tiejun.chen@intel.com>
---
 arch/x86/kvm/mmu.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/x86/kvm/mmu.h b/arch/x86/kvm/mmu.h
index bde8ee7..0e98b5e 100644
--- a/arch/x86/kvm/mmu.h
+++ b/arch/x86/kvm/mmu.h
@@ -58,6 +58,8 @@
 
 static inline u64 rsvd_bits(int s, int e)
 {
+	if (unlikely(s > e))
+		return 0;
 	return ((1ULL << (e - s + 1)) - 1) << s;
 }
 
-- 
1.9.1


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

end of thread, other threads:[~2014-11-17  9:27 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-14  9:31 [RFC][PATCH 1/2] kvm: x86: mmu: return zero if s > e in rsvd_bits() Tiejun Chen
2014-11-14  9:31 ` [RFC][PATCH 2/2] kvm: x86: mmio: fix setting the present bit of mmio spte Tiejun Chen
2014-11-14 10:11   ` Paolo Bonzini
2014-11-17  1:55     ` Chen, Tiejun
2014-11-14 10:06 ` [RFC][PATCH 1/2] kvm: x86: mmu: return zero if s > e in rsvd_bits() Paolo Bonzini
2014-11-17  1:34   ` Chen, Tiejun
2014-11-17  9:22     ` Paolo Bonzini
2014-11-17  9:27       ` Chen, Tiejun

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