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

Sharad Mishra snmishra at us.ibm.com
Wed Jan 18 20:47:57 UTC 2012


+1

Sharad Mishra
Open Virtualization
Linux Technology Center
IBM

libvirt-cim-bounces at redhat.com wrote on 01/18/2012 08:06:12 AM:

> "Eduardo Lima (Etrunko)" <eblima at linux.vnet.ibm.com>
> Sent by: libvirt-cim-bounces at redhat.com
>
> 01/18/2012 08:06 AM
>
> Please respond to
> List for discussion and development of libvirt CIM
<libvirt-cim at redhat.com>
>
> To
>
> libvirt-cim at redhat.com
>
> cc
>
> "Eduardo Lima \(Etrunko\)" <eblima at br.ibm.com>
>
> Subject
>
> [Libvirt-cim] [PATCH 4/4] Fix possible use of unitialized variables
>
> 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
>
> _______________________________________________
> Libvirt-cim mailing list
> Libvirt-cim at redhat.com
> https://www.redhat.com/mailman/listinfo/libvirt-cim
>




More information about the Libvirt-cim mailing list