All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@citrix.com>
To: xen-devel@lists.xenproject.org
Cc: Wei Liu <wei.liu2@citrix.com>,
	linux-kernel@vger.kernel.org,
	Julien Grall <julien.grall@citrix.com>,
	David Vrabel <david.vrabel@citrix.com>,
	Boris Ostrovsky <boris.ostrovsky@oracle.com>,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 2/7] xen/xenbus: client: Fix call of virt_to_mfn in xenbus_grant_ring
Date: Wed, 17 Jun 2015 15:28:03 +0100	[thread overview]
Message-ID: <1434551288-14113-3-git-send-email-julien.grall__42555.6981623687$1434551437$gmane$org@citrix.com> (raw)
In-Reply-To: <1434551288-14113-1-git-send-email-julien.grall@citrix.com>

virt_to_mfn should take a void* rather an unsigned long. While it
doesn't really matter now, it would throw a compiler warning later when
virt_to_mfn will enforce the type.

At the same time, avoid to compute new virtual address every time in the
loop and directly increment the parameter as we don't use it later.

Signed-off-by: Julien Grall <julien.grall@citrix.com>
Reviewed-by: David Vrabel <david.vrabel@citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>

---
    Changes in v2:
        - Remove the cast to (char *)
        - Add David's Reviewed-by
---
 drivers/xen/xenbus/xenbus_client.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/xen/xenbus/xenbus_client.c b/drivers/xen/xenbus/xenbus_client.c
index a014016..9ad3272 100644
--- a/drivers/xen/xenbus/xenbus_client.c
+++ b/drivers/xen/xenbus/xenbus_client.c
@@ -379,16 +379,16 @@ int xenbus_grant_ring(struct xenbus_device *dev, void *vaddr,
 	int i, j;
 
 	for (i = 0; i < nr_pages; i++) {
-		unsigned long addr = (unsigned long)vaddr +
-			(PAGE_SIZE * i);
 		err = gnttab_grant_foreign_access(dev->otherend_id,
-						  virt_to_mfn(addr), 0);
+						  virt_to_mfn(vaddr), 0);
 		if (err < 0) {
 			xenbus_dev_fatal(dev, err,
 					 "granting access to ring page");
 			goto fail;
 		}
 		grefs[i] = err;
+
+		vaddr = vaddr + PAGE_SIZE;
 	}
 
 	return 0;
-- 
2.1.4

  parent reply	other threads:[~2015-06-17 14:28 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-17 14:28 [PATCH v2 0/7] xen: Clean up Julien Grall
2015-06-17 14:28 ` Julien Grall
2015-06-17 14:28 ` Julien Grall
2015-06-17 14:28 ` Julien Grall
2015-06-17 14:28 ` [PATCH v2 1/7] xen: Include xen/page.h rather than asm/xen/page.h Julien Grall
2015-06-17 14:28   ` Julien Grall
2015-06-17 14:28 ` Julien Grall
2015-06-17 14:28 ` Julien Grall [this message]
2015-06-17 14:28 ` [PATCH v2 2/7] xen/xenbus: client: Fix call of virt_to_mfn in xenbus_grant_ring Julien Grall
2015-06-17 14:28   ` Julien Grall
2015-06-17 14:28 ` [PATCH v2 3/7] xen/grant-table: Remove unused macro SPP Julien Grall
2015-06-17 14:28   ` Julien Grall
2015-06-17 14:28 ` Julien Grall
2015-06-17 14:28 ` [PATCH v2 4/7] arm/xen: Drop duplicate define mfn_to_virt Julien Grall
2015-06-17 14:28   ` Julien Grall
2015-06-17 14:28 ` Julien Grall
2015-06-17 14:28 ` [PATCH v2 5/7] block/xen-blkfront: Remove unused macro MAXIMUM_OUTSTANDING_BLOCK_REQS Julien Grall
2015-06-17 14:28 ` Julien Grall
2015-06-17 14:28   ` Julien Grall
2015-06-17 14:28 ` [PATCH v2 6/7] block/xen-blkfront: Remove invalid comment Julien Grall
2015-06-17 14:28 ` Julien Grall
2015-06-17 14:28   ` Julien Grall
2015-06-17 14:28 ` [PATCH v2 7/7] block/xen-blkback: s/nr_pages/nr_segs/ Julien Grall
2015-06-17 14:28   ` Julien Grall
2015-06-17 14:28 ` Julien Grall
2015-06-17 15:36 ` [Xen-devel] [PATCH v2 0/7] xen: Clean up David Vrabel
2015-06-17 15:36   ` David Vrabel
2015-06-17 15:36 ` David Vrabel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='1434551288-14113-3-git-send-email-julien.grall__42555.6981623687$1434551437$gmane$org@citrix.com' \
    --to=julien.grall@citrix.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=david.vrabel@citrix.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.