Re: [Xen-devel] [PATCH 4/6] common/gnttab: gnttab_setup_table() cleanup

2017-08-15 Thread Jan Beulich
>>> On 15.08.17 at 14:30,  wrote:
> Drop pointless debugging messages, and reduce variable scope.

... and correct the type of an induction variable.

> Signed-off-by: Andrew Cooper 

Reviewed-by: Jan Beulich 



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


[Xen-devel] [PATCH 4/6] common/gnttab: gnttab_setup_table() cleanup

2017-08-15 Thread Andrew Cooper
Drop pointless debugging messages, and reduce variable scope.

Signed-off-by: Andrew Cooper 
---
CC: George Dunlap 
CC: Jan Beulich 
CC: Stefano Stabellini 
CC: Tim Deegan 
CC: Wei Liu 
---
 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 31b010d..6ed86f5 100644
--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -1647,20 +1647,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;
-inti;
-xen_pfn_t  gmfn;
+unsigned int i;
 
 if ( count != 1 )
 return -EINVAL;
 
-if ( unlikely(copy_from_guest(, uop, 1) != 0) )
-{
-gdprintk(XENLOG_INFO, "Fault while reading gnttab_setup_table_t.\n");
+if ( unlikely(copy_from_guest(, uop, 1)) )
 return -EFAULT;
-}
 
 if ( unlikely(op.nr_frames > max_grant_frames) )
 {
@@ -1677,12 +1674,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;
@@ -1709,9 +1705,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, , 1) )
 op.status = GNTST_bad_virt_addr;
 }
-- 
2.1.4


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