From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48452) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZDDTM-0000Jf-Rc for qemu-devel@nongnu.org; Thu, 09 Jul 2015 11:10:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZDDTE-0000sv-V1 for qemu-devel@nongnu.org; Thu, 09 Jul 2015 11:10:48 -0400 Received: from e28smtp06.in.ibm.com ([122.248.162.6]:51718) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZDDTD-0000qy-Qi for qemu-devel@nongnu.org; Thu, 09 Jul 2015 11:10:40 -0400 Received: from /spool/local by e28smtp06.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 9 Jul 2015 20:40:35 +0530 Received: from d28relay04.in.ibm.com (d28relay04.in.ibm.com [9.184.220.61]) by d28dlp02.in.ibm.com (Postfix) with ESMTP id 2FA44394005C for ; Thu, 9 Jul 2015 20:40:31 +0530 (IST) Received: from d28av02.in.ibm.com (d28av02.in.ibm.com [9.184.220.64]) by d28relay04.in.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t69FAC8C61472926 for ; Thu, 9 Jul 2015 20:40:13 +0530 Received: from d28av02.in.ibm.com (localhost [127.0.0.1]) by d28av02.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t69DvMHB019843 for ; Thu, 9 Jul 2015 19:27:22 +0530 Date: Thu, 9 Jul 2015 20:40:04 +0530 From: Bharata B Rao Message-ID: <20150709151004.GA4827@in.ibm.com> References: <1435956624-21609-1-git-send-email-ehabkost@redhat.com> <1435956624-21609-6-git-send-email-ehabkost@redhat.com> <559E8139.8030809@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <559E8139.8030809@redhat.com> Subject: Re: [Qemu-devel] [PULL 5/6] numa: Store boot memory address range in node_info Reply-To: bharata@linux.vnet.ibm.com List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: Peter Maydell , "Michael S. Tsirkin" , Eduardo Habkost , qemu-devel@nongnu.org On Thu, Jul 09, 2015 at 04:12:09PM +0200, Paolo Bonzini wrote: > > > On 03/07/2015 22:50, Eduardo Habkost wrote: > > From: Bharata B Rao > > > > Store memory address range information of boot memory in address > > range list of numa_info. > > > > This helps to have a common NUMA node lookup by address function that > > works for both boot-time memory and hotplugged memory. > > > > Signed-off-by: Bharata B Rao > > Reviewed-by: David Gibson > > Tested-by: Igor Mammedov > > Signed-off-by: Eduardo Habkost > > --- > > numa.c | 27 +++++++++++++++++++++++++++ > > 1 file changed, 27 insertions(+) > > > > diff --git a/numa.c b/numa.c > > index 116d1fb..a73f648 100644 > > --- a/numa.c > > +++ b/numa.c > > @@ -56,6 +56,14 @@ void numa_set_mem_node_id(ram_addr_t addr, uint64_t size, uint32_t node) > > { > > struct numa_addr_range *range = g_malloc0(sizeof(*range)); > > > > + /* > > + * Memory-less nodes can come here with 0 size in which case, > > + * there is nothing to do. > > + */ > > + if (!size) { > > + return; > > This leaks "range". Should I post this fix as an independent thread ? numa: Fix memory leak in numa_set_mem_node_id() From: Bharata B Rao Fix a memory leak in numa_set_mem_node_id(). Signed-off-by: Bharata B Rao --- numa.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/numa.c b/numa.c index 3c80059..402804b 100644 --- a/numa.c +++ b/numa.c @@ -54,7 +54,7 @@ NodeInfo numa_info[MAX_NODES]; void numa_set_mem_node_id(ram_addr_t addr, uint64_t size, uint32_t node) { - struct numa_addr_range *range = g_malloc0(sizeof(*range)); + struct numa_addr_range *range; /* * Memory-less nodes can come here with 0 size in which case, @@ -64,6 +64,7 @@ void numa_set_mem_node_id(ram_addr_t addr, uint64_t size, uint32_t node) return; } + range = g_malloc0(sizeof(*range)); range->mem_start = addr; range->mem_end = addr + size - 1; QLIST_INSERT_HEAD(&numa_info[node].addr, range, entry);