From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Vrabel Subject: Re: xen/gntdev: add ioctl for grant copy Date: Thu, 14 Jan 2016 10:07:30 +0000 Message-ID: <56977362.2070804@citrix.com> References: <20160113195654.GA17620@mwanda> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aJeob-0008IB-4F for xen-devel@lists.xenproject.org; Thu, 14 Jan 2016 10:07:37 +0000 In-Reply-To: <20160113195654.GA17620@mwanda> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Dan Carpenter Cc: xen-devel@lists.xenproject.org List-Id: xen-devel@lists.xenproject.org On 13/01/16 19:56, Dan Carpenter wrote: > Hello David Vrabel, > > The patch a4cdb556cae0: "xen/gntdev: add ioctl for grant copy" from > Dec 2, 2014, leads to the following static checker warning: > > drivers/xen/gntdev.c:775 gntdev_get_page() > warn: mask and shift to zero > > drivers/xen/gntdev.c > 761 static int gntdev_get_page(struct gntdev_copy_batch *batch, void __user *virt, > 762 bool writeable, unsigned long *gfn) > 763 { > 764 unsigned long addr = (unsigned long)virt; > 765 struct page *page; > 766 unsigned long xen_pfn; > 767 int ret; > 768 > 769 ret = get_user_pages_fast(addr, 1, writeable, &page); > 770 if (ret < 0) > 771 return ret; > 772 > 773 batch->pages[batch->nr_pages++] = page; > 774 > 775 xen_pfn = page_to_xen_pfn(page) + XEN_PFN_DOWN(addr & ~PAGE_MASK); > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > This is zero most of the time. Did you intend the bitwise negate? This is non-zero if XEN_PAGE_SIZE < PAGE_SIZE and is needed for this case. David