Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755512AbbFQO3T (ORCPT ); Wed, 17 Jun 2015 10:29:19 -0400 Received: from smtp.citrix.com ([66.165.176.89]:20583 "EHLO SMTP.CITRIX.COM" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932230AbbFQO2u (ORCPT ); Wed, 17 Jun 2015 10:28:50 -0400 X-IronPort-AV: E=Sophos;i="5.13,633,1427760000"; d="scan'208";a="272885265" From: Julien Grall To: CC: , , Julien Grall , David Vrabel , Wei Liu , "Konrad Rzeszutek Wilk" , Boris Ostrovsky 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 Message-ID: <1434551288-14113-3-git-send-email-julien.grall@citrix.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1434551288-14113-1-git-send-email-julien.grall@citrix.com> References: <1434551288-14113-1-git-send-email-julien.grall@citrix.com> MIME-Version: 1.0 Content-Type: text/plain X-DLP: MIA2 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1705 Lines: 53 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 Reviewed-by: David Vrabel Cc: Wei Liu Cc: Konrad Rzeszutek Wilk Cc: Boris Ostrovsky --- 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/