[Libvirt-cim] [PATCH 4/4] Fix possible use of unitialized variables

Eduardo Lima (Etrunko) eblima at linux.vnet.ibm.com
Fri Jan 13 18:53:22 UTC 2012


From: "Eduardo Lima (Etrunko)" <eblima at br.ibm.com>

As revealed by recent Coverity scan report provided by Red Hat:
https://bugzilla.redhat.com/show_bug.cgi?id=750418
https://bugzilla.redhat.com/attachment.cgi?id=552325

Error: UNINIT:
Virt_VirtualSystemManagementService.c:2798: var_decl: Declaring variable "s" without initializer.
Virt_VirtualSystemManagementService.c:2901: uninit_use: Using uninitialized value "s": field "s".msg is uninitialized.

Error: UNINIT:
Virt_VirtualSystemSnapshotService.c:393: var_decl: Declaring variable "s" without initializer.
Virt_VirtualSystemSnapshotService.c:398: uninit_use_in_call: Using uninitialized value "s.rc" when calling "new_context".
Virt_VirtualSystemSnapshotService.c:378: read_parm_fld: Reading a parameter field.

Signed-off-by: Eduardo Lima (Etrunko) <eblima at br.ibm.com>
---
 src/Virt_VirtualSystemManagementService.c |    2 +-
 src/Virt_VirtualSystemSnapshotService.c   |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/Virt_VirtualSystemManagementService.c b/src/Virt_VirtualSystemManagementService.c
index 3a0b423..6f42c42 100644
--- a/src/Virt_VirtualSystemManagementService.c
+++ b/src/Virt_VirtualSystemManagementService.c
@@ -2732,7 +2732,7 @@ static CMPIStatus _update_resources_for(const CMPIContext *context,
                                         CMPIInstance *rasd,
                                         resmod_fn func)
 {
-        CMPIStatus s;
+        CMPIStatus s = {CMPI_RC_OK, NULL};
         struct domain *dominfo = NULL;
         uint16_t type;
         char *xml = NULL;
diff --git a/src/Virt_VirtualSystemSnapshotService.c b/src/Virt_VirtualSystemSnapshotService.c
index 898fa57..aae628f 100644
--- a/src/Virt_VirtualSystemSnapshotService.c
+++ b/src/Virt_VirtualSystemSnapshotService.c
@@ -390,7 +390,7 @@ static CMPIStatus start_snapshot_job(const CMPIObjectPath *ref,
                                      CMPIArgs *argsout)
 {
         struct snap_context *ctx;
-        CMPIStatus s;
+        CMPIStatus s = {CMPI_RC_OK, NULL};
         CMPIObjectPath *job;
         CMPIObjectPath *vssd;
         CMPIInstance *inst;
-- 
1.7.7.5




More information about the Libvirt-cim mailing list