From: Juergen Gross <jgross@suse.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>,
Xen-devel <xen-devel@lists.xen.org>
Cc: Wei Liu <wei.liu2@citrix.com>,
Ian Jackson <Ian.Jackson@eu.citrix.com>,
Ian Campbell <Ian.Campbell@citrix.com>
Subject: Re: [PATCH] tools/libxc: Initialise parameters in map_p2m_list() for error paths
Date: Thu, 7 Jan 2016 16:06:16 +0100 [thread overview]
Message-ID: <568E7EE8.5020803@suse.com> (raw)
In-Reply-To: <1452178530-4450-1-git-send-email-andrew.cooper3@citrix.com>
On 07/01/16 15:55, Andrew Cooper wrote:
> c/s 7bf7458 "libxc: support of linear p2m list for migration of
> pv-domains" breaks compilation on CentOS 7 because of 'ptes' being
> possibly uninitialised after the 'err:' label.
>
> The migration will fail early for conditions which would cause the for()
> loop not to run, but the compiler doesn't know this.
>
> Initialise the parameters to safe default to make the function more
> robust.
>
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Juergen Gross <jgross@suse.com>
Thanks for catching this.
Juergen
> ---
> CC: Ian Campbell <Ian.Campbell@citrix.com>
> CC: Ian Jackson <Ian.Jackson@eu.citrix.com>
> CC: Wei Liu <wei.liu2@citrix.com>
> CC: Juergen Gross <jgross@suse.com>
> ---
> tools/libxc/xc_sr_save_x86_pv.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/libxc/xc_sr_save_x86_pv.c b/tools/libxc/xc_sr_save_x86_pv.c
> index 4deb58f..ab4bbe0 100644
> --- a/tools/libxc/xc_sr_save_x86_pv.c
> +++ b/tools/libxc/xc_sr_save_x86_pv.c
> @@ -316,9 +316,9 @@ static int map_p2m_list(struct xc_sr_context *ctx, uint64_t p2m_cr3)
> xc_interface *xch = ctx->xch;
> xen_vaddr_t p2m_vaddr, p2m_end, mask, off;
> xen_pfn_t p2m_mfn, mfn, saved_mfn, max_pfn;
> - uint64_t *ptes;
> + uint64_t *ptes = NULL;
> xen_pfn_t *mfns;
> - unsigned fpp, n_pages, level, shift, idx_start, idx_end, idx, saved_idx;
> + unsigned fpp, n_pages = 0, level, shift, idx_start, idx_end, idx, saved_idx;
> int rc = -1;
>
> p2m_mfn = cr3_to_mfn(ctx, p2m_cr3);
>
prev parent reply other threads:[~2016-01-07 15:06 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-07 14:55 [PATCH] tools/libxc: Initialise parameters in map_p2m_list() for error paths Andrew Cooper
2016-01-07 15:04 ` Wei Liu
2016-01-07 15:06 ` Ian Campbell
2016-01-07 15:19 ` Juergen Gross
2016-01-07 15:24 ` Andrew Cooper
2016-01-07 15:35 ` Ian Campbell
2016-01-07 15:06 ` Juergen Gross [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=568E7EE8.5020803@suse.com \
--to=jgross@suse.com \
--cc=Ian.Campbell@citrix.com \
--cc=Ian.Jackson@eu.citrix.com \
--cc=andrew.cooper3@citrix.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).