From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53424) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XEHHf-0008HW-2K for qemu-devel@nongnu.org; Mon, 04 Aug 2014 08:22:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XEHHa-0008Hx-EX for qemu-devel@nongnu.org; Mon, 04 Aug 2014 08:22:35 -0400 Received: from mx1.redhat.com ([209.132.183.28]:16383) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XEHHa-0008G7-80 for qemu-devel@nongnu.org; Mon, 04 Aug 2014 08:22:30 -0400 Date: Mon, 4 Aug 2014 14:22:48 +0200 From: "Michael S. Tsirkin" Message-ID: <20140804122248.GA15491@redhat.com> References: <798e3da98da2d7e39b1a012ce5e5ca940e86bc4d.1407139490.git.hutao@cn.fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <798e3da98da2d7e39b1a012ce5e5ca940e86bc4d.1407139490.git.hutao@cn.fujitsu.com> Subject: Re: [Qemu-devel] [PATCH 2/3] pc-dimm: check if the value of node property List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Hu Tao Cc: Igor Mammedov , qemu-devel@nongnu.org On Mon, Aug 04, 2014 at 04:16:08PM +0800, Hu Tao wrote: > If user specifies a node number that exceeds the available numa nodes in > emulated system for pc-dimm device, the device will reports an invalid _PXM > to OSPM. Fix it by checking the node value. > > Signed-off-by: Hu Tao > --- > 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); PRId32 is wrong here, this variable is int, use %d. Also, this message isn't very clear, I fixed it up with a patch on top. > + return; > + } > } > > static MemoryRegion *pc_dimm_get_memory_region(PCDIMMDevice *dimm) > -- > 1.9.3