]> git.ipfire.org Git - thirdparty/libvirt.git/commit
Ensure nodeinfo struct is initialized to zero
authorDaniel P. Berrange <berrange@redhat.com>
Wed, 23 Jan 2013 15:43:21 +0000 (15:43 +0000)
committerDaniel P. Berrange <berrange@redhat.com>
Thu, 24 Jan 2013 14:13:26 +0000 (14:13 +0000)
commit83b4137d41a4f0dbf18ccd6bb2e86ef7cb59686d
treefe2cf63a900150bdecc34cc5b03b64831a90b9f0
parent3b35369c0fbc58988f4f68ca2cdb87c481f42e98
Ensure nodeinfo struct is initialized to zero

When linuxNodeInfoCPUPopulate() method triggered use of an
uninitialize value, since it did not initialize the 'sockets'
field in the virNodeInfoPtr struct:

==30020== Conditional jump or move depends on uninitialised value(s)
==30020==    at 0x5125DBD: linuxNodeInfoCPUPopulate (nodeinfo.c:513)
==30020==    by 0x51261A0: nodeGetInfo (nodeinfo.c:884)
==30020==    by 0x149B9B10: qemuCapsInit (qemu_capabilities.c:846)
==30020==    by 0x14A11B25: qemuCreateCapabilities (qemu_driver.c:424)
==30020==    by 0x14A12426: qemuStartup (qemu_driver.c:874)
==30020==    by 0x512A7AF: virStateInitialize (libvirt.c:822)
==30020==    by 0x40DE04: daemonRunStateInit (libvirtd.c:877)
==30020==    by 0x50ADCE5: virThreadHelper (virthreadpthread.c:161)
==30020==    by 0x328CA07D14: start_thread (pthread_create.c:308)
==30020==    by 0x328C6F246C: clone (clone.S:114)
(happened twice)

        if (socks > nodeinfo->sockets)    <--- here
            nodeinfo->sockets = socks;

Rather than doing this for each field, just make the caller memset
the entire struct to zero.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
src/nodeinfo.c