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

Re: [Xen-devel] [PATCH 1/2] x86/hvm/dmop: fix EFAULT condition



> -----Original Message-----
> From: Wei Liu [mailto:wei.liu2@xxxxxxxxxx]
> Sent: 28 September 2017 11:24
> To: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
> Cc: Wei Liu <wei.liu2@xxxxxxxxxx>; Jan Beulich <jbeulich@xxxxxxxx>;
> Andrew Cooper <Andrew.Cooper3@xxxxxxxxxx>; Paul Durrant
> <Paul.Durrant@xxxxxxxxxx>
> 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.liu2@xxxxxxxxxx>
> ---
> Cc: Jan Beulich <jbeulich@xxxxxxxx>
> Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
> Cc: Paul Durrant <paul.durrant@xxxxxxxxxx>
> 
> 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@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

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