Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933147AbbESOPe (ORCPT ); Tue, 19 May 2015 10:15:34 -0400 Received: from smtp.citrix.com ([66.165.176.89]:31805 "EHLO SMTP.CITRIX.COM" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933063AbbESOPc (ORCPT ); Tue, 19 May 2015 10:15:32 -0400 X-IronPort-AV: E=Sophos;i="5.13,458,1427760000"; d="scan'208";a="264027177" Message-ID: <555B44BB.1090200@citrix.com> Date: Tue, 19 May 2015 15:12:11 +0100 From: Julien Grall User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.6.0 MIME-Version: 1.0 To: David Vrabel , Julien Grall , CC: Wei Liu , , , , , Boris Ostrovsky , Subject: Re: [Xen-devel] [RFC 02/23] xen/xenbus: client: Fix call of virt_to_mfn in xenbus_grant_ring References: <1431622863-28575-1-git-send-email-julien.grall@citrix.com> <1431622863-28575-3-git-send-email-julien.grall@citrix.com> <555B3FF6.4050902@citrix.com> In-Reply-To: <555B3FF6.4050902@citrix.com> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-DLP: MIA2 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1182 Lines: 40 Hi David, On 19/05/15 14:51, David Vrabel wrote: >> --- 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 = (char *)vaddr + PAGE_SIZE; > > You don't need the cast here since vaddr is a void *. Arithmetic on void pointer is a GCC extension [1]. I wasn't sure what is the Linux policy on it. Regards, [1] https://gcc.gnu.org/onlinedocs/gcc/Pointer-Arith.html#Pointer-Arith -- Julien Grall -- 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/