> -----Original Message-----
> From: Wei Liu [mailto:wei.l...@citrix.com]
> Sent: 28 September 2017 11:24
> To: Xen-devel <xen-de...@lists.xenproject.org>
> Cc: Wei Liu <wei.l...@citrix.com>; Jan Beulich <jbeul...@suse.com>;
> Andrew Cooper <andrew.coop...@citrix.com>; Paul Durrant
> <paul.durr...@citrix.com>
> Subject: [PATCH 1/2] x86/hvm/dmop: fix EFAULT condition
> 
> The copy macro returns false when the copy fails.
> 
> Signed-off-by: Wei Liu <wei.l...@citrix.com>
> ---
> Cc: Jan Beulich <jbeul...@suse.com>
> Cc: Andrew Cooper <andrew.coop...@citrix.com>
> Cc: Paul Durrant <paul.durr...@citrix.com>
> 
> Backport to 4.9
> ---
>  xen/arch/x86/hvm/dm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/xen/arch/x86/hvm/dm.c b/xen/arch/x86/hvm/dm.c
> index 87ef4b6ca9..b1cf0d54a2 100644
> --- a/xen/arch/x86/hvm/dm.c
> +++ b/xen/arch/x86/hvm/dm.c
> @@ -182,7 +182,7 @@ static int modified_memory(struct domain *d,
> 
>          rc = COPY_FROM_GUEST_BUF_OFFSET(extent,
>              bufs, EXTENTS_BUFFER, (*rem_extents - 1) * sizeof(extent));
> -        if ( rc )
> +        if ( !rc )
>              return -EFAULT;

For clarity and consistency I think it would be better to avoid use of rc in 
this case and simply put the call to COPY_FROM_GUEST_BUF_OFFSET() inside the if 
clause.

  Paul

> 
>          if ( extent.pad )
> --
> 2.11.0


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

Reply via email to