|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 10/14] libxl: Check xc_maximum_ram_page for negative return values.
On Mon, 2015-03-16 at 11:39 -0400, Konrad Rzeszutek Wilk wrote:
> Instead of assuming everything is always OK.
>
> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
> ---
> tools/libxc/xg_save_restore.h | 3 +++
> tools/misc/xen-mfndump.c | 2 +-
> 2 files changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/tools/libxc/xg_save_restore.h b/tools/libxc/xg_save_restore.h
> index bdd9009..6d26a0a 100644
> --- a/tools/libxc/xg_save_restore.h
> +++ b/tools/libxc/xg_save_restore.h
> @@ -313,6 +313,9 @@ static inline int get_platform_info(xc_interface *xch,
> uint32_t dom,
>
> *max_mfn = xc_maximum_ram_page(xch);
>
> + if (*max_mfn < 0)
> + return 0;
*max_mfn is unsigned, so the negative would have been lost already.
Perhaps do the same sort of thing with a helper as the last patch?
> +
> *hvirt_start = xen_params.virt_start;
>
> if ( xc_domain_get_guest_width(xch, dom, guest_width) != 0)
> diff --git a/tools/misc/xen-mfndump.c b/tools/misc/xen-mfndump.c
> index 0761f6e..81ef448 100644
> --- a/tools/misc/xen-mfndump.c
> +++ b/tools/misc/xen-mfndump.c
> @@ -184,7 +184,7 @@ int dump_ptes_func(int argc, char *argv[])
>
> /* Map M2P and obtain gpfn */
> max_mfn = xc_maximum_ram_page(xch);
> - if ( (mfn > max_mfn) ||
> + if ( (max_mfn < 0 ) || (mfn > max_mfn) ||
Same here.
> !(m2p_table = xc_map_m2p(xch, max_mfn, PROT_READ, NULL)) )
> {
> xc_unmap_domain_meminfo(xch, &minfo);
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |