From patchwork Tue Apr 13 18:11:25 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 92233 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o3DIBSBZ015121 for ; Tue, 13 Apr 2010 18:11:28 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753180Ab0DMSL0 (ORCPT ); Tue, 13 Apr 2010 14:11:26 -0400 Received: from bombadil.infradead.org ([18.85.46.34]:53133 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753020Ab0DMSLZ (ORCPT ); Tue, 13 Apr 2010 14:11:25 -0400 Received: from hch by bombadil.infradead.org with local (Exim 4.69 #1 (Red Hat Linux)) id 1O1ka5-0001M0-2G; Tue, 13 Apr 2010 18:11:25 +0000 Date: Tue, 13 Apr 2010 14:11:25 -0400 From: Christoph Hellwig To: "Michael S. Tsirkin" Cc: Christoph Hellwig , kvm@vger.kernel.org Subject: Re: [PATCH] vhost: fix sparse warnings Message-ID: <20100413181124.GA5043@infradead.org> References: <20100405192410.GA19569@infradead.org> <20100407182011.GA1755@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20100407182011.GA1755@redhat.com> User-Agent: Mutt/1.5.19 (2009-01-05) X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org See http://www.infradead.org/rpr.html Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Tue, 13 Apr 2010 18:11:28 +0000 (UTC) Index: linux-2.6/drivers/vhost/net.c =================================================================== --- linux-2.6.orig/drivers/vhost/net.c 2010-04-05 21:13:24.196004388 +0200 +++ linux-2.6/drivers/vhost/net.c 2010-04-05 21:13:32.726004109 +0200 @@ -641,7 +641,7 @@ static struct miscdevice vhost_net_misc &vhost_net_fops, }; -int vhost_net_init(void) +static int vhost_net_init(void) { int r = vhost_init(); if (r) @@ -658,7 +658,7 @@ err_init: } module_init(vhost_net_init); -void vhost_net_exit(void) +static void vhost_net_exit(void) { misc_deregister(&vhost_net_misc); vhost_cleanup(); Index: linux-2.6/drivers/vhost/vhost.c =================================================================== --- linux-2.6.orig/drivers/vhost/vhost.c 2010-04-05 21:12:58.806004249 +0200 +++ linux-2.6/drivers/vhost/vhost.c 2010-04-05 21:14:44.681010674 +0200 @@ -710,7 +710,7 @@ int vhost_log_write(struct vhost_virtque return 0; } -int translate_desc(struct vhost_dev *dev, u64 addr, u32 len, +static int translate_desc(struct vhost_dev *dev, u64 addr, u32 len, struct iovec iov[], int iov_size) { const struct vhost_memory_region *reg; @@ -736,7 +736,7 @@ int translate_desc(struct vhost_dev *dev _iov = iov + ret; size = reg->memory_size - addr + reg->guest_phys_addr; _iov->iov_len = min((u64)len, size); - _iov->iov_base = (void *)(unsigned long) + _iov->iov_base = (void __user *)(unsigned long) (reg->userspace_addr + addr - reg->guest_phys_addr); s += size; addr += size; @@ -990,7 +990,7 @@ void vhost_discard_vq_desc(struct vhost_ * want to notify the guest, using eventfd. */ int vhost_add_used(struct vhost_virtqueue *vq, unsigned int head, int len) { - struct vring_used_elem *used; + struct vring_used_elem __user *used; /* The virtqueue contains a ring of used buffers. Get a pointer to the * next entry in that used ring. */ @@ -1014,7 +1014,8 @@ int vhost_add_used(struct vhost_virtqueu smp_wmb(); /* Log used ring entry write. */ log_write(vq->log_base, - vq->log_addr + ((void *)used - (void *)vq->used), + vq->log_addr + + ((void __user *)used - (void __user *)vq->used), sizeof *used); /* Log used index update. */ log_write(vq->log_base,