Skip to contentSkip to conversation

x86/hvm: Fix operator precedence bug introduced by 3d4d4f9336

PATCH New Andrew Cooper 1 participant 1 message Sep 3, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/hvm: Fix operator precedence bug introduced by 3d4d4f9336

Bitwise or has greater precedence than the ternary operator, making the result of the expression a constant P2M_UNSHARE.

Coverity-ID: 1234633

CC Jan Beulich <[email protected]>
CC Tim Deegan <[email protected]>
CC Tamas K Lengyel <[email protected]>
---
 xen/arch/x86/hvm/hvm.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/x86/hvm/hvm.c +1 -1
index 83e6fae..8d905d3 100644
@@ -2796,7 +2796,7 @@ int hvm_hap_nested_page_fault(paddr_t gpa, unsigned long gla,
 
     p2m = p2m_get_hostp2m(v->domain);
     mfn = get_gfn_type_access(p2m, gfn, &p2mt, &p2ma, 
-                              P2M_ALLOC | npfec.write_access ? P2M_UNSHARE : 0,
+                              P2M_ALLOC | (npfec.write_access ? P2M_UNSHARE : 0),
                               NULL);
 
     /* Check access permissions first, then handle faults */
Signature · 1 line
1.7.10.4