52 lines
2.0 KiB
Diff
52 lines
2.0 KiB
Diff
From e51fa6486d82c2f2c6a98c1c11bf93dfbaaf75f3 Mon Sep 17 00:00:00 2001
|
|
Message-Id: <e51fa6486d82c2f2c6a98c1c11bf93dfbaaf75f3.1384729615.git.crobinso@redhat.com>
|
|
In-Reply-To: <9265a89ae8e70495a989411b628429bcaf47c25e.1384729615.git.crobinso@redhat.com>
|
|
References: <9265a89ae8e70495a989411b628429bcaf47c25e.1384729615.git.crobinso@redhat.com>
|
|
From: Jeremy Fitzhardinge <jeremy@goop.org>
|
|
Date: Wed, 30 Oct 2013 10:38:08 -0700
|
|
Subject: [PATCH 2/2] libxl: fix dubious cpumask handling in
|
|
libxlDomainSetVcpuAffinities
|
|
|
|
Rather than casting the virBitmap pointer to uint8_t* and then using
|
|
the structure contents as a byte array, use the virBitmap API to determine
|
|
the bitmap size and test each bit.
|
|
|
|
Signed-off-by: Jeremy Fitzhardinge <jeremy@goop.org>
|
|
(cherry picked from commit ba1bf10063a0205c1de12b209b0282833710214f)
|
|
---
|
|
src/libxl/libxl_driver.c | 10 ++++++----
|
|
1 file changed, 6 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
|
|
index adaec75..f47aceb 100644
|
|
--- a/src/libxl/libxl_driver.c
|
|
+++ b/src/libxl/libxl_driver.c
|
|
@@ -808,7 +808,7 @@ libxlDomainSetVcpuAffinities(libxlDriverPrivatePtr driver, virDomainObjPtr vm)
|
|
libxlDomainObjPrivatePtr priv = vm->privateData;
|
|
virDomainDefPtr def = vm->def;
|
|
libxl_bitmap map;
|
|
- uint8_t *cpumask = NULL;
|
|
+ virBitmapPtr cpumask = NULL;
|
|
uint8_t *cpumap = NULL;
|
|
virNodeInfo nodeinfo;
|
|
size_t cpumaplen;
|
|
@@ -829,10 +829,12 @@ libxlDomainSetVcpuAffinities(libxlDriverPrivatePtr driver, virDomainObjPtr vm)
|
|
goto cleanup;
|
|
}
|
|
|
|
- cpumask = (uint8_t*) def->cputune.vcpupin[vcpu]->cpumask;
|
|
+ cpumask = def->cputune.vcpupin[vcpu]->cpumask;
|
|
|
|
- for (i = 0; i < VIR_DOMAIN_CPUMASK_LEN; ++i) {
|
|
- if (cpumask[i])
|
|
+ for (i = 0; i < virBitmapSize(cpumask); ++i) {
|
|
+ bool bit;
|
|
+ ignore_value(virBitmapGetBit(cpumask, i, &bit));
|
|
+ if (bit)
|
|
VIR_USE_CPU(cpumap, i);
|
|
}
|
|
|
|
--
|
|
1.8.4.2
|
|
|