From patchwork Sun Nov 22 10:28:01 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 62028 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id nAMAVWGW028022 for ; Sun, 22 Nov 2009 10:31:32 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752598AbZKVKa4 (ORCPT ); Sun, 22 Nov 2009 05:30:56 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751946AbZKVKa4 (ORCPT ); Sun, 22 Nov 2009 05:30:56 -0500 Received: from mx1.redhat.com ([209.132.183.28]:19762 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751496AbZKVKaz (ORCPT ); Sun, 22 Nov 2009 05:30:55 -0500 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id nAMAUaM6020493 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 22 Nov 2009 05:30:36 -0500 Received: from redhat.com (vpn-6-8.tlv.redhat.com [10.35.6.8]) by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with SMTP id nAMAUXne027002; Sun, 22 Nov 2009 05:30:34 -0500 Date: Sun, 22 Nov 2009 12:28:01 +0200 From: "Michael S. Tsirkin" To: Alan Cox , Rusty Russell , virtualization@lists.linux-foundation.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] vhost: Fix warnings and bad type handling Message-ID: <20091122102801.GA13644@redhat.com> References: <20091117154213.3683.94554.stgit@localhost.localdomain> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20091117154213.3683.94554.stgit@localhost.localdomain> User-Agent: Mutt/1.5.19 (2009-01-05) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.18 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index 97233d5..e7b4dea 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c @@ -322,6 +322,8 @@ static long vhost_set_vring(struct vhost_dev *d, int ioctl, void __user *argp) r = -EOPNOTSUPP; break; } + /* For 32bit, verify that the top 32bits of the user + data are set to zero. */ if ((u64)(unsigned long)a.desc_user_addr != a.desc_user_addr || (u64)(unsigned long)a.used_user_addr != a.used_user_addr || (u64)(unsigned long)a.avail_user_addr != a.avail_user_addr) { @@ -334,7 +336,8 @@ static long vhost_set_vring(struct vhost_dev *d, int ioctl, void __user *argp) r = -EINVAL; break; } - r = init_used(vq, (struct vring_used __user *)a.used_user_addr); + r = init_used(vq, (struct vring_used __user *)(unsigned long) + a.used_user_addr); if (r) break; vq->log_used = !!(a.flags & (0x1 << VHOST_VRING_F_LOG));