[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 2/3] libxl/remus: Move the assert before the info is used.



On Mon, 2016-01-25 at 16:06 -0500, Konrad Rzeszutek Wilk wrote:
> The assert(info) is after quite a lot of manipulations
> on 'info' - which makes the assert pointless because if
> info was NULL it would have crashed earlier.
> 
> Move it earlier so that it guards before we try using
> the 'info' structure.

That assert (wherever it is placed) is rather aggressive for an application
provided argument. ERROR_INVALID would be more normal I think.

> 
> CC: Wen Congyang <wency@xxxxxxxxxxxxxx>
> CC: Yang Hongyang <hongyang.yang@xxxxxxxxxxxx>
> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
> ---
> Âtools/libxl/libxl.c | 4 ++--
> Â1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
> index 2bde0f5..60974cc 100644
> --- a/tools/libxl/libxl.c
> +++ b/tools/libxl/libxl.c
> @@ -855,6 +855,8 @@ int libxl_domain_remus_start(libxl_ctx *ctx,
> libxl_domain_remus_info *info,
> ÂÂÂÂÂÂÂÂÂgoto out;
> ÂÂÂÂÂ}
> Â
> +ÂÂÂÂassert(info);
> +
> ÂÂÂÂÂlibxl_defbool_setdefault(&info->allow_unsafe, false);
> ÂÂÂÂÂlibxl_defbool_setdefault(&info->blackhole, false);
> ÂÂÂÂÂlibxl_defbool_setdefault(&info->compression, true);
> @@ -883,8 +885,6 @@ int libxl_domain_remus_start(libxl_ctx *ctx,
> libxl_domain_remus_info *info,
> ÂÂÂÂÂdss->debug = 0;
> ÂÂÂÂÂdss->remus = info;
> Â
> -ÂÂÂÂassert(info);
> -
> ÂÂÂÂÂ/* Point of no return */
> ÂÂÂÂÂlibxl__remus_setup(egc, dss);
> ÂÂÂÂÂreturn AO_INPROGRESS;

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.