From: Jan Beulich Date: Tue, 27 Feb 2018 13:10:00 +0000 (+0100) Subject: x86/PV: fix off-by-one in I/O bitmap limit check X-Git-Tag: archive/raspbian/4.11.1-1+rpi1~1^2~66^2~510 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=c6527bc66b6dd7a8dadaebb1047c8e52c6c5793c;p=xen.git x86/PV: fix off-by-one in I/O bitmap limit check 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 --- 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;