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

[Xen-changelog] [xen master] common/gnttab: gnttab_setup_table() cleanup



commit 1603696c27bbf47cfff71de5b958a3f8232e80a4
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Tue Jun 20 10:40:56 2017 +0100
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Tue Aug 15 15:08:57 2017 +0100

    common/gnttab: gnttab_setup_table() cleanup
    
    Drop pointless debugging messages, reduce variable scope, and correct the 
type
    of an induction variable.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
---
 xen/common/grant_table.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c
index 8a7f3f9..b97d2b9 100644
--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -1628,20 +1628,17 @@ static long
 gnttab_setup_table(
     XEN_GUEST_HANDLE_PARAM(gnttab_setup_table_t) uop, unsigned int count)
 {
+    struct vcpu *curr = current;
     struct gnttab_setup_table op;
     struct domain *d = NULL;
     struct grant_table *gt;
-    int            i;
-    xen_pfn_t  gmfn;
+    unsigned int i;
 
     if ( count != 1 )
         return -EINVAL;
 
-    if ( unlikely(copy_from_guest(&op, uop, 1) != 0) )
-    {
-        gdprintk(XENLOG_INFO, "Fault while reading gnttab_setup_table_t.\n");
+    if ( unlikely(copy_from_guest(&op, uop, 1)) )
         return -EFAULT;
-    }
 
     if ( unlikely(op.nr_frames > max_grant_frames) )
     {
@@ -1658,12 +1655,11 @@ gnttab_setup_table(
     d = rcu_lock_domain_by_any_id(op.dom);
     if ( d == NULL )
     {
-        gdprintk(XENLOG_INFO, "Bad domid %d.\n", op.dom);
         op.status = GNTST_bad_domain;
         goto out;
     }
 
-    if ( xsm_grant_setup(XSM_TARGET, current->domain, d) )
+    if ( xsm_grant_setup(XSM_TARGET, curr->domain, d) )
     {
         op.status = GNTST_permission_denied;
         goto out;
@@ -1690,9 +1686,11 @@ gnttab_setup_table(
     op.status = GNTST_okay;
     for ( i = 0; i < op.nr_frames; i++ )
     {
-        gmfn = gnttab_shared_gmfn(d, gt, i);
+        xen_pfn_t gmfn = gnttab_shared_gmfn(d, gt, i);
+
         /* Grant tables cannot be shared */
         BUG_ON(SHARED_M2P(gmfn));
+
         if ( __copy_to_guest_offset(op.frame_list, i, &gmfn, 1) )
             op.status = GNTST_bad_virt_addr;
     }
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

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