diff mbox

[v2,1/5] tools/libxenctrl: fix error check after opening libxenforeignmemory

Message ID 1487770058-21040-2-git-send-email-paul.durrant@citrix.com (mailing list archive)
State New, archived
Headers show

Commit Message

Paul Durrant Feb. 22, 2017, 1:27 p.m. UTC
Checking the value of xch->xcall is clearly incorrect. The code should be
checking xch->fmem (i.e. the return of the previously called function).

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
---
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
---
 tools/libxc/xc_private.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Wei Liu Feb. 22, 2017, 2:09 p.m. UTC | #1
On Wed, Feb 22, 2017 at 01:27:34PM +0000, Paul Durrant wrote:
> Checking the value of xch->xcall is clearly incorrect. The code should be
> checking xch->fmem (i.e. the return of the previously called function).
> 
> Signed-off-by: Paul Durrant <paul.durrant@citrix.com>

Acked-by: Wei Liu <wei.liu2@citrix.com>

Ian, please backport this.

> ---
> Cc: Ian Jackson <ian.jackson@eu.citrix.com>
> Cc: Wei Liu <wei.liu2@citrix.com>
> ---
>  tools/libxc/xc_private.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/tools/libxc/xc_private.c b/tools/libxc/xc_private.c
> index f0e089c..9df6925 100644
> --- a/tools/libxc/xc_private.c
> +++ b/tools/libxc/xc_private.c
> @@ -64,8 +64,7 @@ struct xc_interface_core *xc_interface_open(xentoollog_logger *logger,
>          goto err;
>  
>      xch->fmem = xenforeignmemory_open(xch->error_handler, 0);
> -
> -    if ( xch->xcall == NULL )
> +    if ( xch->fmem == NULL )
>          goto err;
>  
>      return xch;
> -- 
> 2.1.4
>
Ian Jackson Feb. 22, 2017, 2:09 p.m. UTC | #2
Paul Durrant writes ("[PATCH v2 1/5] tools/libxenctrl: fix error check after opening libxenforeignmemory"):
> Checking the value of xch->xcall is clearly incorrect. The code should be
> checking xch->fmem (i.e. the return of the previously called function).

Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Ian Jackson April 5, 2017, 1:25 p.m. UTC | #3
Wei Liu writes ("Re: [PATCH v2 1/5] tools/libxenctrl: fix error check after opening libxenforeignmemory"):
> On Wed, Feb 22, 2017 at 01:27:34PM +0000, Paul Durrant wrote:
> > Checking the value of xch->xcall is clearly incorrect. The code should be
> > checking xch->fmem (i.e. the return of the previously called function).
> > 
> > Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
> 
> Acked-by: Wei Liu <wei.liu2@citrix.com>
> 
> Ian, please backport this.

I hvae applied this to 4.7 and 4.8.

Ian.
diff mbox

Patch

diff --git a/tools/libxc/xc_private.c b/tools/libxc/xc_private.c
index f0e089c..9df6925 100644
--- a/tools/libxc/xc_private.c
+++ b/tools/libxc/xc_private.c
@@ -64,8 +64,7 @@  struct xc_interface_core *xc_interface_open(xentoollog_logger *logger,
         goto err;
 
     xch->fmem = xenforeignmemory_open(xch->error_handler, 0);
-
-    if ( xch->xcall == NULL )
+    if ( xch->fmem == NULL )
         goto err;
 
     return xch;