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

Commit 94102ae

Browse files
authored
Merge pull request #351 from intel/secure-scan
Fix some minor issues from static code scan
2 parents 3cc634d + cd7cc62 commit 94102ae

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

core/include/paging.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ static inline void pte64_set_global(pte64_t *entry, uint lvl, bool g)
363363
static inline void pte64_set_ad(pte64_t *entry, uint lvl, bool d)
364364
{
365365
hax_assert(is_leaf(lvl));
366-
entry->raw |= (d ? 0x60 : 0x20);
366+
entry->raw |= (uint64_t)(d ? 0x60 : 0x20);
367367
}
368368

369369
static inline void pte64_set_accessed(pte64_t *entry, uint lvl)

core/vcpu.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ static int exit_invalid_guest_state(struct vcpu_t *vcpu,
100100
static int exit_ept_misconfiguration(struct vcpu_t *vcpu,
101101
struct hax_tunnel *htun);
102102
static int exit_ept_violation(struct vcpu_t *vcpu, struct hax_tunnel *htun);
103-
static int exit_unsupported_instruction(struct vcpu_t *vcpu,
103+
static int exit_unsupported_instruction(struct vcpu_t *vcpu,
104104
struct hax_tunnel *htun);
105105
static int null_handler(struct vcpu_t *vcpu, struct hax_tunnel *hun);
106106

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

28852885
hax_log(HAX_LOGD, "Ignore guest DR%d read due to hw bp enabled.\n",
28862886
dreg);
2887-
} else {
2887+
} else if (dr != NULL) {
28882888
state->_regs[gpr_reg] = *dr;
28892889
}
28902890
} else {
28912891
// MOV DR <- GPR
28922892
if (hbreak_enabled) {
28932893
hax_log(HAX_LOGD, "Ignore guest DR%d write due to hw bp enabled.\n",
28942894
dreg);
2895-
} else {
2895+
} else if (dr != NULL) {
28962896
*dr = state->_regs[gpr_reg];
28972897
vcpu->dr_dirty = 1;
28982898
}
@@ -3675,7 +3675,7 @@ static int exit_ept_violation(struct vcpu_t *vcpu, struct hax_tunnel *htun)
36753675
return vcpu_emulate_insn(vcpu);
36763676
}
36773677

3678-
static int exit_unsupported_instruction(struct vcpu_t *vcpu,
3678+
static int exit_unsupported_instruction(struct vcpu_t *vcpu,
36793679
struct hax_tunnel *htun)
36803680
{
36813681
hax_inject_exception(vcpu, VECTOR_UD, NO_ERROR_CODE);

core/vmx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ uint64_t vmread(struct vcpu_t *vcpu, component_index_t component)
216216

217217
uint64_t vmread_dump(struct vcpu_t *vcpu, unsigned enc, const char *name)
218218
{
219-
uint64_t val;
219+
uint64_t val = 0;
220220

221221
switch ((enc >> 13) & 0x3) {
222222
case 0:

0 commit comments

Comments
 (0)