From: Andrew Cooper Date: Wed, 27 Jun 2018 12:26:36 +0000 (+0100) Subject: x86: Address "Bitwise-and with zero CONSTANT_EXPRESSION_RESULT" Coverity issues X-Git-Tag: archive/raspbian/4.14.0+80-gd101b417b7-1+rpi1^2~63^2~3691 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=0932210ac0956fe0ce6f23cf73f56d7c2f9bc5df;p=xen.git x86: Address "Bitwise-and with zero CONSTANT_EXPRESSION_RESULT" Coverity issues Coverity complains at code which which performs a bitwise and with a constant that happens to be zero. Rearrange the C to test the constant first and short circuit the bitwise and. No functional change. Signed-off-by: Andrew Cooper Acked-by: Jan Beulich --- diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c index 4629bcaa47..a1a1f5f3c3 100644 --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c @@ -1225,7 +1225,7 @@ void put_page_from_l1e(l1_pgentry_t l1e, struct domain *l1e_owner) * (Note that the undestroyable active grants are not a security hole in * Xen. All active grants can safely be cleaned up when the domain dies.) */ - if ( (l1e_get_flags(l1e) & _PAGE_GNTTAB) && + if ( _PAGE_GNTTAB && (l1e_get_flags(l1e) & _PAGE_GNTTAB) && !l1e_owner->is_shutting_down && !l1e_owner->is_dying ) { gdprintk(XENLOG_WARNING,