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

Re: [Xen-devel] [PATCH] libxc: Have xc_translate_foreign_address() set errno properly



On Wed, Mar 02, 2016 at 08:51:51AM +0200, Razvan Cojocaru wrote:
> Currently it's possible for xc_translate_foreign_address() to fail
> and errno still be set to success. This patch fixes the issue.
> Based on the first half of Don Slutz' patch:
> http://lists.xen.org/archives/html/xen-devel/2014-03/msg03720.html
> 
> Signed-off-by: Razvan Cojocaru <rcojocaru@xxxxxxxxxxxxxxx>
> ---
>  tools/libxc/xc_pagetab.c | 36 +++++++++++++++++++++++++++++++++---
>  1 file changed, 33 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/libxc/xc_pagetab.c b/tools/libxc/xc_pagetab.c
> index ec97890..f7dc30b 100644
> --- a/tools/libxc/xc_pagetab.c
> +++ b/tools/libxc/xc_pagetab.c
> @@ -34,9 +34,14 @@ unsigned long xc_translate_foreign_address(xc_interface 
> *xch, uint32_t dom,
>      int size, level, pt_levels = 2;
>      void *map;
>  
> -    if (xc_domain_getinfo(xch, dom, 1, &dominfo) != 1 
> +    if (xc_domain_getinfo(xch, dom, 1, &dominfo) != 1
>          || dominfo.domid != dom)
> +    {
> +        if (errno == 0)
> +            errno = EINVAL;
> +
>          return 0;
> +    }
>  

Shouldn't we look into fixing the libxc functions that fail to set errno?

With an approach like this you end up getting whatever errno set prior
to calling xc_ function, which isn't very helpful in any case.

Wei.

_______________________________________________
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®.