mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 10:11:27 +01:00
libxl: correctly handle libxl_get_cpu_topology failure in libxl_{cpu, node}map_to_{node, cpu}map
Initialize nr_cpus to 0 so that if it is unchanged by a failing libxl_get_cpu_topology, libxl_cputopology_list_free still works OK afterward. Coverity-ID: 1055294 Coverity-ID: 1055295 Signed-off-by: Matthew Daley <mattjd@gmail.com> Acked-by: Dario Faggioli <dario.faggioli@citrix.com>
This commit is contained in:
1 parent
14cd36c23d
commit
1e143e2ae8
1 file changed
+2
-2
@@ -650,7 +650,7 @@ int libxl_nodemap_to_cpumap(libxl_ctx *ctx,
|
||||
libxl_bitmap *cpumap)
|
||||
{
|
||||
libxl_cputopology *tinfo = NULL;
|
||||
int nr_cpus, i, rc = 0;
|
||||
int nr_cpus = 0, i, rc = 0;
|
||||
|
||||
tinfo = libxl_get_cpu_topology(ctx, &nr_cpus);
|
||||
if (tinfo == NULL) {
|
||||
@@ -673,7 +673,7 @@ int libxl_cpumap_to_nodemap(libxl_ctx *ctx,
|
||||
libxl_bitmap *nodemap)
|
||||
{
|
||||
libxl_cputopology *tinfo = NULL;
|
||||
int nr_cpus, i, rc = 0;
|
||||
int nr_cpus = 0, i, rc = 0;
|
||||
|
||||
tinfo = libxl_get_cpu_topology(ctx, &nr_cpus);
|
||||
if (tinfo == NULL) {
|
||||
|
||||