All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wei Liu <wei.liu2@citrix.com>
To: Razvan Cojocaru <rcojocaru@bitdefender.com>
Cc: wei.liu2@citrix.com, stefano.stabellini@eu.citrix.com,
	ian.jackson@eu.citrix.com, xen-devel@lists.xen.org
Subject: Re: [PATCH] libxc: Have xc_translate_foreign_address() set errno properly
Date: Thu, 3 Mar 2016 12:47:05 +0000	[thread overview]
Message-ID: <20160303124705.GF5535@citrix.com> (raw)
In-Reply-To: <1456901511-22065-1-git-send-email-rcojocaru@bitdefender.com>

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@bitdefender.com>
> ---
>  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@lists.xen.org
http://lists.xen.org/xen-devel

  reply	other threads:[~2016-03-03 12:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-02  6:51 [PATCH] libxc: Have xc_translate_foreign_address() set errno properly Razvan Cojocaru
2016-03-03 12:47 ` Wei Liu [this message]
2016-03-03 12:53   ` Razvan Cojocaru
2016-03-03 12:54     ` Wei Liu

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=20160303124705.GF5535@citrix.com \
    --to=wei.liu2@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=rcojocaru@bitdefender.com \
    --cc=stefano.stabellini@eu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.