Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-12077

Possibly uninitialized variable in vmware datastore processing

XMLWordPrintable

    • Icon: Incident report Incident report
    • Resolution: Duplicate
    • Icon: Trivial Trivial
    • 4.0 (plan)
    • 3.2.4
    • Proxy (P), Server (S)
    • None
    • Sprint 25, Sprint 26
    • 0.125

      If hypervisor has no associated datastores there is a potential problem with datastore variable being uninitialized:

      checks_simple_vmware.c: In function ‘check_vcenter_hv_datastore_size’:
      checks_simple_vmware.c:1752:35: warning: ‘datastore’ may be used uninitialized in this function [-Wmaybe-uninitialized]
          if (ZBX_MAX_UINT64 == datastore->free_space)
      

      I'm not sure if in practice there can be hypervisors without datastores, but we need to fix it:

      Index: src/zabbix_server/poller/checks_simple_vmware.c
      ===================================================================
      --- src/zabbix_server/poller/checks_simple_vmware.c     (revision 67391)
      +++ src/zabbix_server/poller/checks_simple_vmware.c     (working copy)
      @@ -1656,7 +1656,7 @@
              zbx_vmware_service_t    *service;
              zbx_vmware_hv_t         *hv;
              int                     i, ret = SYSINFO_RET_FAIL, mode;
      -       zbx_vmware_datastore_t  *datastore;
      +       zbx_vmware_datastore_t  *datastore = NULL;
       
              zabbix_log(LOG_LEVEL_DEBUG, "In %s()", __function_name);
      

            MVekslers Michael Veksler
            wiper Andris Zeila
            Team C
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: