diff options
author | neel <neel@FreeBSD.org> | 2015-04-15 05:04:42 +0000 |
---|---|---|
committer | neel <neel@FreeBSD.org> | 2015-04-15 05:04:42 +0000 |
commit | f6d3ccf1a3b4788efef76b61c845b4a489d051b0 (patch) | |
tree | 1df40eae41a1b28266e61511f5ee5ddef3a35a85 /usr.sbin/bhyvectl | |
parent | efbeb6710147d21e5a708d5742e14c8c892591e3 (diff) | |
download | FreeBSD-src-f6d3ccf1a3b4788efef76b61c845b4a489d051b0.zip FreeBSD-src-f6d3ccf1a3b4788efef76b61c845b4a489d051b0.tar.gz |
Initialize 'error' before use.
Reported by: Coverity Scan
CID: 1249748, 1249747, 1249751, 1249749
MFC after: 1 week
Diffstat (limited to 'usr.sbin/bhyvectl')
-rw-r--r-- | usr.sbin/bhyvectl/bhyvectl.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/usr.sbin/bhyvectl/bhyvectl.c b/usr.sbin/bhyvectl/bhyvectl.c index e2b514d..223ee25 100644 --- a/usr.sbin/bhyvectl/bhyvectl.c +++ b/usr.sbin/bhyvectl/bhyvectl.c @@ -640,9 +640,9 @@ get_all_registers(struct vmctx *ctx, int vcpu) uint64_t cr0, cr3, cr4, dr7, rsp, rip, rflags, efer; uint64_t rax, rbx, rcx, rdx, rsi, rdi, rbp; uint64_t r8, r9, r10, r11, r12, r13, r14, r15; - int error; + int error = 0; - if (get_efer || get_all) { + if (!error && (get_efer || get_all)) { error = vm_get_register(ctx, vcpu, VM_REG_GUEST_EFER, &efer); if (error == 0) printf("efer[%d]\t\t0x%016lx\n", vcpu, efer); @@ -787,10 +787,10 @@ get_all_registers(struct vmctx *ctx, int vcpu) static int get_all_segments(struct vmctx *ctx, int vcpu) { - int error; uint64_t cs, ds, es, fs, gs, ss, tr, ldtr; + int error = 0; - if (get_desc_ds || get_all) { + if (!error && (get_desc_ds || get_all)) { error = vm_get_desc(ctx, vcpu, VM_REG_GUEST_DS, &desc_base, &desc_limit, &desc_access); if (error == 0) { @@ -935,9 +935,9 @@ static int get_misc_vmcs(struct vmctx *ctx, int vcpu) { uint64_t ctl, cr0, cr3, cr4, rsp, rip, pat, addr, u64; - int error; - - if (get_cr0_mask || get_all) { + int error = 0; + + if (!error && (get_cr0_mask || get_all)) { uint64_t cr0mask; error = vm_get_vmcs_field(ctx, vcpu, VMCS_CR0_MASK, &cr0mask); if (error == 0) @@ -1161,9 +1161,9 @@ static int get_misc_vmcb(struct vmctx *ctx, int vcpu) { uint64_t ctl, addr; - int error; + int error = 0; - if (get_vmcb_intercept || get_all) { + if (!error && (get_vmcb_intercept || get_all)) { error = vm_get_vmcb_field(ctx, vcpu, VMCB_OFF_CR_INTERCEPT, 4, &ctl); if (error == 0) |