From c6527bc66b6dd7a8dadaebb1047c8e52c6c5793c Mon Sep 17 00:00:00 2001 From: Jan Beulich Date: Tue, 27 Feb 2018 14:10:00 +0100 Subject: [PATCH] x86/PV: fix off-by-one in I/O bitmap limit check MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit With everyone having their tags below agreeing that putting things the other way around in the comparison makes things easier to understand, do that rearrangement while changing the line anyway. Signed-off-by: Jan Beulich Reviewed-by: Roger Pau Monné Reviewed-by: Andrew Cooper --- xen/arch/x86/pv/emul-priv-op.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c index a6bad88488..ecb3b9c47b 100644 --- a/xen/arch/x86/pv/emul-priv-op.c +++ b/xen/arch/x86/pv/emul-priv-op.c @@ -136,7 +136,7 @@ static bool guest_io_okay(unsigned int port, unsigned int bytes, if ( iopl_ok(v, regs) ) return true; - if ( v->arch.pv_vcpu.iobmp_limit > (port + bytes) ) + if ( (port + bytes) <= v->arch.pv_vcpu.iobmp_limit ) { union { uint8_t bytes[2]; uint16_t mask; } x; -- 2.30.2