From: Peter Dinda Date: Tue, 1 Sep 2015 21:47:54 +0000 (-0500) Subject: Cleanup and sanity-checking of assorted additional issues from second pass (Coverity... X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=commitdiff_plain;h=c6d28a5255ee5d1995865fc615bbe2481b19996d;p=palacios.git Cleanup and sanity-checking of assorted additional issues from second pass (Coverity static analysis) --- diff --git a/palacios/src/palacios/svm_msr.c b/palacios/src/palacios/svm_msr.c index bdc8569..bca1dd2 100644 --- a/palacios/src/palacios/svm_msr.c +++ b/palacios/src/palacios/svm_msr.c @@ -37,6 +37,7 @@ static int get_bitmap_index(uint_t msr) { + // unsigend cmoparison with zero intentional for clarity if ((msr >= PENTIUM_MSRS_START) && (msr <= PENTIUM_MSRS_END)) { return (PENTIUM_MSRS_INDEX + (msr - PENTIUM_MSRS_START)); diff --git a/palacios/src/palacios/vmcb.c b/palacios/src/palacios/vmcb.c index f23cf70..12cf36f 100644 --- a/palacios/src/palacios/vmcb.c +++ b/palacios/src/palacios/vmcb.c @@ -262,7 +262,7 @@ void PrintDebugVMCB(vmcb_t * vmcb) { } } - for (i=0;i<4;i++) { + for (i=0;i<3;i++) { if (ctrl_area->rsvd2[i]) { PrintDebug(VM_NONE, VCORE_NONE, "control rsvd2[%d] has value 0x%x\n", i, ctrl_area->rsvd2[i]); } diff --git a/palacios/src/palacios/vmm_extensions.c b/palacios/src/palacios/vmm_extensions.c index af2c0e2..44004cc 100644 --- a/palacios/src/palacios/vmm_extensions.c +++ b/palacios/src/palacios/vmm_extensions.c @@ -59,8 +59,8 @@ int V3_init_extensions() { while (tmp_ext != __stop__v3_extensions) { - if ((*tmp_ext) && (*tmp_ext)->init && ((*tmp_ext)->init() != 0)) { - PrintError(VM_NONE, VCORE_NONE, "Could not initialize extension (%s)\n", (*tmp_ext)->name); + if (!(*tmp_ext) || !(*tmp_ext)->init || ((*tmp_ext)->init() != 0)) { + PrintError(VM_NONE, VCORE_NONE, "Could not initialize extension (%s)\n", (*tmp_ext) ? (*tmp_ext)->name : "UNKNOWN"); return -1; }