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

@@ -652,9 +652,9 @@ static int32_t write_protect_page(struct acrn_vm *vm,const struct wp_data *wp)
vm->vm_id, wp->gpa, hpa);
base_paddr = get_hv_image_base();
if (((hpa <= base_paddr) && (hpa + CPU_PAGE_SIZE > base_paddr)) ||
if (((hpa <= base_paddr) && ((hpa + CPU_PAGE_SIZE) > base_paddr)) ||
((hpa >= base_paddr) &&
(hpa < base_paddr + CONFIG_HV_RAM_SIZE))) {
(hpa < (base_paddr + CONFIG_HV_RAM_SIZE)))) {
pr_err("%s: overlap the HV memory region.", __func__);
return -EINVAL;
}