diff options
author | Hu Tao <hutao@cn.fujitsu.com> | 2014-08-04 16:16:08 +0800 |
---|---|---|
committer | Michael Roth <mdroth@linux.vnet.ibm.com> | 2014-09-08 11:23:04 -0500 |
commit | 044af98ea8d5c2e36a18a123659e1f032a8cb75f (patch) | |
tree | d8c9cee11a2a027c532da321104e6f7406ccf131 | |
parent | 7c68c5402a1e1b91566694af0e33ee333d07e767 (diff) | |
download | qemu-044af98ea8d5c2e36a18a123659e1f032a8cb75f.tar.gz |
pc-dimm: validate node property
If user specifies a node number that exceeds the available numa nodes in
emulated system for pc-dimm device, the device will report an invalid _PXM
to OSPM. Fix this by checking the node property value.
Cc: qemu-stable@nongnu.org
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit cfe0ffd0272f1a6d34d27ac1a7072d1c42d33ad3)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
-rw-r--r-- | hw/mem/pc-dimm.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/hw/mem/pc-dimm.c b/hw/mem/pc-dimm.c index 08f49ed53b..92e276f2f4 100644 --- a/hw/mem/pc-dimm.c +++ b/hw/mem/pc-dimm.c @@ -252,6 +252,11 @@ static void pc_dimm_realize(DeviceState *dev, Error **errp) error_setg(errp, "'" PC_DIMM_MEMDEV_PROP "' property is not set"); return; } + if (dimm->node >= nb_numa_nodes) { + error_setg(errp, "'" PC_DIMM_NODE_PROP + "' exceeds numa node number: %" PRId32, nb_numa_nodes); + return; + } } static MemoryRegion *pc_dimm_get_memory_region(PCDIMMDevice *dimm) |