Skip to content
This repository has been archived by the owner on Jan 28, 2023. It is now read-only.

Commit

Permalink
Merge pull request #351 from intel/secure-scan
Browse files Browse the repository at this point in the history
Fix some minor issues from static code scan
  • Loading branch information
wcwang authored Mar 3, 2021
2 parents 3cc634d + cd7cc62 commit 94102ae
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion core/include/paging.h
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ static inline void pte64_set_global(pte64_t *entry, uint lvl, bool g)
static inline void pte64_set_ad(pte64_t *entry, uint lvl, bool d)
{
hax_assert(is_leaf(lvl));
entry->raw |= (d ? 0x60 : 0x20);
entry->raw |= (uint64_t)(d ? 0x60 : 0x20);
}

static inline void pte64_set_accessed(pte64_t *entry, uint lvl)
Expand Down
8 changes: 4 additions & 4 deletions core/vcpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ static int exit_invalid_guest_state(struct vcpu_t *vcpu,
static int exit_ept_misconfiguration(struct vcpu_t *vcpu,
struct hax_tunnel *htun);
static int exit_ept_violation(struct vcpu_t *vcpu, struct hax_tunnel *htun);
static int exit_unsupported_instruction(struct vcpu_t *vcpu,
static int exit_unsupported_instruction(struct vcpu_t *vcpu,
struct hax_tunnel *htun);
static int null_handler(struct vcpu_t *vcpu, struct hax_tunnel *hun);

Expand Down Expand Up @@ -2884,15 +2884,15 @@ static int exit_dr_access(struct vcpu_t *vcpu, struct hax_tunnel *htun)

hax_log(HAX_LOGD, "Ignore guest DR%d read due to hw bp enabled.\n",
dreg);
} else {
} else if (dr != NULL) {
state->_regs[gpr_reg] = *dr;
}
} else {
// MOV DR <- GPR
if (hbreak_enabled) {
hax_log(HAX_LOGD, "Ignore guest DR%d write due to hw bp enabled.\n",
dreg);
} else {
} else if (dr != NULL) {
*dr = state->_regs[gpr_reg];
vcpu->dr_dirty = 1;
}
Expand Down Expand Up @@ -3675,7 +3675,7 @@ static int exit_ept_violation(struct vcpu_t *vcpu, struct hax_tunnel *htun)
return vcpu_emulate_insn(vcpu);
}

static int exit_unsupported_instruction(struct vcpu_t *vcpu,
static int exit_unsupported_instruction(struct vcpu_t *vcpu,
struct hax_tunnel *htun)
{
hax_inject_exception(vcpu, VECTOR_UD, NO_ERROR_CODE);
Expand Down
2 changes: 1 addition & 1 deletion core/vmx.c
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ uint64_t vmread(struct vcpu_t *vcpu, component_index_t component)

uint64_t vmread_dump(struct vcpu_t *vcpu, unsigned enc, const char *name)
{
uint64_t val;
uint64_t val = 0;

switch ((enc >> 13) & 0x3) {
case 0:
Expand Down

0 comments on commit 94102ae

Please sign in to comment.