From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60499) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XMh9p-0003Y0-41 for qemu-devel@nongnu.org; Wed, 27 Aug 2014 13:37:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XMh9e-0002uO-Bz for qemu-devel@nongnu.org; Wed, 27 Aug 2014 13:37:17 -0400 Received: from e31.co.us.ibm.com ([32.97.110.149]:49794) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XMh9e-0002u9-4b for qemu-devel@nongnu.org; Wed, 27 Aug 2014 13:37:06 -0400 Received: from /spool/local by e31.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 27 Aug 2014 11:37:05 -0600 From: Michael Roth Date: Wed, 27 Aug 2014 12:36:05 -0500 Message-Id: <1409160982-16389-9-git-send-email-mdroth@linux.vnet.ibm.com> In-Reply-To: <1409160982-16389-1-git-send-email-mdroth@linux.vnet.ibm.com> References: <1409160982-16389-1-git-send-email-mdroth@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH 08/25] pc-dimm: validate node property List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org From: Hu Tao 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 Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin (cherry picked from commit cfe0ffd0272f1a6d34d27ac1a7072d1c42d33ad3) Signed-off-by: Michael Roth --- hw/mem/pc-dimm.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hw/mem/pc-dimm.c b/hw/mem/pc-dimm.c index 08f49ed..92e276f 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) -- 1.9.1