diff mbox series

[1/5] xen/vm-event: Drop unused u_domctl parameter from vm_event_domctl()

Message ID 1559564728-17167-2-git-send-email-andrew.cooper3@citrix.com (mailing list archive)
State New, archived
Headers show
Series xen/vm-event: Cleanup | expand

Commit Message

Andrew Cooper June 3, 2019, 12:25 p.m. UTC
This parameter isn't used at all.  Futhermore, elide the copyback in
failing cases, as it is only successful paths which generate data which
needs sending back to the caller.

Finally, drop a redundant d == NULL check, as that logic is all common
at the begining of do_domctl().

No functional change.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Razvan Cojocaru <rcojocaru@bitdefender.com>
CC: Tamas K Lengyel <tamas@tklengyel.com>
CC: Petre Pircalabu <ppircalabu@bitdefender.com>
---
 xen/common/domctl.c        | 6 +++---
 xen/common/vm_event.c      | 6 +-----
 xen/include/xen/vm_event.h | 3 +--
 3 files changed, 5 insertions(+), 10 deletions(-)

Comments

Razvan Cojocaru June 3, 2019, 1:52 p.m. UTC | #1
On 6/3/19 3:25 PM, Andrew Cooper wrote:
> This parameter isn't used at all.  Futhermore, elide the copyback in
> failing cases, as it is only successful paths which generate data which
> needs sending back to the caller.
> 
> Finally, drop a redundant d == NULL check, as that logic is all common
> at the begining of do_domctl().
> 
> No functional change.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>

Acked-by: Razvan Cojocaru <rcojocaru@bitdefender.com>


Thanks,
Razvan
Jan Beulich June 3, 2019, 1:52 p.m. UTC | #2
>>> On 03.06.19 at 14:25, <andrew.cooper3@citrix.com> wrote:
> This parameter isn't used at all.  Futhermore, elide the copyback in
> failing cases, as it is only successful paths which generate data which
> needs sending back to the caller.
> 
> Finally, drop a redundant d == NULL check, as that logic is all common
> at the begining of do_domctl().
> 
> No functional change.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
> ---
> CC: Razvan Cojocaru <rcojocaru@bitdefender.com>
> CC: Tamas K Lengyel <tamas@tklengyel.com>
> CC: Petre Pircalabu <ppircalabu@bitdefender.com>
> ---
>  xen/common/domctl.c        | 6 +++---

Just in cases it's wanted/needed:
Acked-by: Jan Beulich <jbeulich@suse.com>

Jan
diff mbox series

Patch

diff --git a/xen/common/domctl.c b/xen/common/domctl.c
index bade9a6..72a4495 100644
--- a/xen/common/domctl.c
+++ b/xen/common/domctl.c
@@ -1018,9 +1018,9 @@  long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl)
         break;
 
     case XEN_DOMCTL_vm_event_op:
-        ret = vm_event_domctl(d, &op->u.vm_event_op,
-                              guest_handle_cast(u_domctl, void));
-        copyback = 1;
+        ret = vm_event_domctl(d, &op->u.vm_event_op);
+        if ( ret == 0 )
+            copyback = true;
         break;
 
 #ifdef CONFIG_MEM_ACCESS
diff --git a/xen/common/vm_event.c b/xen/common/vm_event.c
index 74a4755..902e152 100644
--- a/xen/common/vm_event.c
+++ b/xen/common/vm_event.c
@@ -583,8 +583,7 @@  void vm_event_cleanup(struct domain *d)
 #endif
 }
 
-int vm_event_domctl(struct domain *d, struct xen_domctl_vm_event_op *vec,
-                    XEN_GUEST_HANDLE_PARAM(void) u_domctl)
+int vm_event_domctl(struct domain *d, struct xen_domctl_vm_event_op *vec)
 {
     int rc;
 
@@ -594,9 +593,6 @@  int vm_event_domctl(struct domain *d, struct xen_domctl_vm_event_op *vec,
         return 0;
     }
 
-    if ( unlikely(d == NULL) )
-        return -ESRCH;
-
     rc = xsm_vm_event_control(XSM_PRIV, d, vec->mode, vec->op);
     if ( rc )
         return rc;
diff --git a/xen/include/xen/vm_event.h b/xen/include/xen/vm_event.h
index 7f6fb6d..3cc2b20 100644
--- a/xen/include/xen/vm_event.h
+++ b/xen/include/xen/vm_event.h
@@ -64,8 +64,7 @@  void vm_event_cancel_slot(struct domain *d, struct vm_event_domain *ved);
 void vm_event_put_request(struct domain *d, struct vm_event_domain *ved,
                           vm_event_request_t *req);
 
-int vm_event_domctl(struct domain *d, struct xen_domctl_vm_event_op *vec,
-                    XEN_GUEST_HANDLE_PARAM(void) u_domctl);
+int vm_event_domctl(struct domain *d, struct xen_domctl_vm_event_op *vec);
 
 void vm_event_vcpu_pause(struct vcpu *v);
 void vm_event_vcpu_unpause(struct vcpu *v);