hv: add brackets to make operator expression more readable

v1-v2:
Bypass this case:
When binary arithmetic operators of different precedence (e.g. '+'
and '*') are mixed in an expression, parentheses are added to the
sub-expressions using the operator with a higher precedence.

v1:
The operator precedence rules are complicated and it is easy to make a mistake.
So add brackets to make operator expression more readable.

Tracked-On: #861
Signed-off-by: Li, Fei1 <fei1.li@intel.com>
This commit is contained in:
Li, Fei1
2018-11-27 23:46:46 +08:00
committed by lijinxia
parent aefe9168d1
commit a1ac585b85
6 changed files with 10 additions and 10 deletions

View File

@@ -259,9 +259,9 @@ hv_emulate_mmio(struct acrn_vcpu *vcpu, struct io_request *io_req)
base = mmio_handler->range_start;
end = mmio_handler->range_end;
if ((address + size <= base) || (address >= end)) {
if (((address + size) <= base) || (address >= end)) {
continue;
} else if (!((address >= base) && (address + size <= end))) {
} else if (!((address >= base) && ((address + size) <= end))) {
pr_fatal("Err MMIO, address:0x%llx, size:%x", address, size);
return -EIO;
} else {

View File

@@ -118,7 +118,7 @@ static void create_secure_world_ept(struct acrn_vm *vm, uint64_t gpa_orig,
*/
dest_pdpte_p = pml4e_page_vaddr(sworld_pml4e);
src_pdpte_p = pml4e_page_vaddr(nworld_pml4e);
for (i = 0U; i < PTRS_PER_PDPTE - 1; i++) {
for (i = 0U; i < (PTRS_PER_PDPTE - 1UL); i++) {
pdpte = get_pgentry(src_pdpte_p);
if ((pdpte & table_present) != 0UL) {
pdpte &= ~EPT_EXE;