On 05/18/2010 04:14 AM, Jim Meyering wrote:
> * tests/nodeinfotest.c (linuxTestCompareFiles): Don't use
> nodeinfo->member uninitialized. linuxNodeInfoCPUPopulate requires
> that some of its nodeinfo members (including threads) be initialized
> upon input. The nodeinfotest.c program lacked the initialization,
> while the only other use (nodeGetInfo) did perform it.
> It's not trivial to move the initialization into the function,
> since nodeGetInfo sets at least one member after clearing the
> buffer but before calling linuxNodeInfoCPUPopulate.
Thanks for documenting the analysis.
+++ b/tests/nodeinfotest.c
@@ -40,6 +40,8 @@ static int linuxTestCompareFiles(const char *cpuinfofile, const char
*outputfile
cpuinfo = fopen(cpuinfofile, "r");
if (!cpuinfo)
return -1;
+
+ memset(&nodeinfo, 0, sizeof(nodeinfo));
if (linuxNodeInfoCPUPopulate(cpuinfo, &nodeinfo) < 0) {
ACK.
--
Eric Blake eblake(a)redhat.com +1-801-349-2682
Libvirt virtualization library
http://libvirt.org