diff mbox

vhost: Fix warnings and bad type handling

Message ID 20091122102801.GA13644@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Michael S. Tsirkin Nov. 22, 2009, 10:28 a.m. UTC
None
diff mbox

Patch

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));