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 cfe0ffd027
)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
This commit is contained in:
parent
7c68c5402a
commit
044af98ea8
|
@ -252,6 +252,11 @@ static void pc_dimm_realize(DeviceState *dev, Error **errp)
|
||||||
error_setg(errp, "'" PC_DIMM_MEMDEV_PROP "' property is not set");
|
error_setg(errp, "'" PC_DIMM_MEMDEV_PROP "' property is not set");
|
||||||
return;
|
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)
|
static MemoryRegion *pc_dimm_get_memory_region(PCDIMMDevice *dimm)
|
||||||
|
|
Loading…
Reference in New Issue