From: Wei Liu Subject: [PATCH] pvgrub: initialise p2m_size Date: Sun, 10 May 2015 14:14:51 +0100 Message-ID: <1431263691-11564-1-git-send-email-wei.liu2@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YrR4O-0004La-HD for xen-devel@lists.xenproject.org; Sun, 10 May 2015 13:15:00 +0000 List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xenproject.org Cc: Ian Jackson , Wei Liu , Ian Campbell List-Id: xen-devel@lists.xenproject.org In 84083790 ("libxc: add p2m_size to xc_dom_image") a new field is added. We should initialised this field in pvgrub as well, otherwise xc_dom_build_image won't work properly. Signed-off-by: Wei Liu Cc: Ian Campbell Cc: Ian Jackson --- stubdom/grub/kexec.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/stubdom/grub/kexec.c b/stubdom/grub/kexec.c index dc8db81..4c33b25 100644 --- a/stubdom/grub/kexec.c +++ b/stubdom/grub/kexec.c @@ -276,12 +276,13 @@ void kexec(void *kernel, long kernel_size, void *module, long module_size, char dom->total_pages = start_info.nr_pages; /* equivalent of arch_setup_meminit */ + dom->p2m_size = dom->total_pages; /* setup initial p2m */ - dom->p2m_host = malloc(sizeof(*dom->p2m_host) * dom->total_pages); + dom->p2m_host = malloc(sizeof(*dom->p2m_host) * dom->p2m_size); /* Start with our current P2M */ - for (i = 0; i < dom->total_pages; i++) + for (i = 0; i < dom->p2m_size; i++) dom->p2m_host[i] = pfn_to_mfn(i); if ( (rc = xc_dom_build_image(dom)) != 0 ) { -- 1.9.1