[libvirt] [PATCH] nodeinfo: avoid uninitialized variable on error
Michal Privoznik
mprivozn at redhat.com
Wed Jun 11 06:18:06 UTC 2014
On 11.06.2014 00:27, Eric Blake wrote:
> Commit 8ba0a58 introduced a compiler warning that I hit during
> a run of ./autobuild.sh:
>
> ../../src/nodeinfo.c: In function 'nodeCapsInitNUMA':
> ../../src/nodeinfo.c:1853:43: error: 'nsiblings' may be used uninitialized in this function [-Werror=maybe-uninitialized]
> if (virCapabilitiesAddHostNUMACell(caps, n, memory,
> ^
>
> Sure enough, nsiblings starts uninitialized, and is set by a call
> to virNodeCapsGetSiblingInfo, but that function fails to assign
> through the pointer if virNumaGetDistances fails.
If that's the case, virNodeCapsGetSiblingInfo() fails too so at the
incriminated lines we jump at cleanup label directly. But maybe the
compiler you've used fails to do analysis this deep.
Michal
More information about the libvir-list
mailing list