diff mbox series

Arm/domctl: correct XEN_DOMCTL_vuart_op error return value

Message ID fa6d6ca6-d133-4a9e-9da4-42b0c0b50437@suse.com (mailing list archive)
State New
Headers show
Series Arm/domctl: correct XEN_DOMCTL_vuart_op error return value | expand

Commit Message

Jan Beulich March 26, 2025, 11:39 a.m. UTC
copy_to_guest() returns the number of bytes not copied; that's not what
the function should return to its caller though. Convert to returning
-EFAULT instead.

Fixes: 86039f2e8c20 ("xen/arm: vpl011: Add a new domctl API to initialize vpl011")
Signed-off-by: Jan Beulich <jbeulich@suse.com>

Comments

Andrew Cooper March 26, 2025, 11:41 a.m. UTC | #1
On 26/03/2025 11:39 am, Jan Beulich wrote:
> copy_to_guest() returns the number of bytes not copied; that's not what
> the function should return to its caller though. Convert to returning
> -EFAULT instead.
>
> Fixes: 86039f2e8c20 ("xen/arm: vpl011: Add a new domctl API to initialize vpl011")
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Orzel, Michal March 26, 2025, 12:31 p.m. UTC | #2
On 26/03/2025 12:41, Andrew Cooper wrote:
> 
> 
> On 26/03/2025 11:39 am, Jan Beulich wrote:
>> copy_to_guest() returns the number of bytes not copied; that's not what
>> the function should return to its caller though. Convert to returning
>> -EFAULT instead.
>>
>> Fixes: 86039f2e8c20 ("xen/arm: vpl011: Add a new domctl API to initialize vpl011")
>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> 
> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Michal Orzel <michal.orzel@amd.com>

~Michal
diff mbox series

Patch

--- a/xen/arch/arm/domctl.c
+++ b/xen/arch/arm/domctl.c
@@ -172,8 +172,8 @@  long arch_do_domctl(struct xen_domctl *d
             break;
         }
 
-        if ( !rc )
-            rc = copy_to_guest(u_domctl, domctl, 1);
+        if ( !rc && copy_to_guest(u_domctl, domctl, 1) )
+            rc = -EFAULT;
 
         return rc;
     }