HV: treewide: fix violations of coding guideline C-TY-02

The coding guideline rule C-TY-02 requires that 'the operands of bit
operations shall be unsigned'. This patch adds explicit casts or literal
suffixes to make explicit the type of values involved in bit operations.
Explicit casts to widen integers before shift operations are also
introduced to make explicit that the variables are expanded BEFORE it is
shifted (which is already so in C99 but implicitly).

This patch has no semantic changes.

Tracked-On: #6776
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Junjie Mao
2021-10-29 11:34:48 +08:00
committed by wenlingz
parent b0dbc1cbfe
commit db20e277b6
4 changed files with 12 additions and 12 deletions

View File

@@ -1333,7 +1333,7 @@ static int32_t emulate_and(struct acrn_vcpu *vcpu, const struct instr_emul_vie *
* perform the operation with the pre-fetched immediate
* operand and write the result
*/
result = val1 & vie->immediate;
result = val1 & (uint64_t)vie->immediate;
vie_mmio_write(vcpu, result);
break;
default:

View File

@@ -74,7 +74,7 @@ static uint64_t cr4_trap_and_passthru_mask = CR4_TRAP_AND_PASSTHRU_BITS; /* boun
#define CR4_EMRSV_BITS_PHYS_VALUE CR4_VMXE
/* The CR4 value guest expected to see for bits of CR4_EMULATED_RESERVE_BITS */
#define CR4_EMRSV_BITS_VIRT_VALUE 0
#define CR4_EMRSV_BITS_VIRT_VALUE 0UL
static uint64_t cr4_rsv_bits_guest_value;
/*