Skip to contentSkip to conversation

vhost: missing __user tags

PATCH In review Michael S. Tsirkin 2 participants 2 messages May 15, 2020 – May 18, 2020

Subsystems (5)
lore
Share & tools
lore

Michael S. Tsirkin

author maintainer
#0 lore raw

PATCH 1/1 vhost: missing __user tags

sparse warns about converting void * to void __user *. This is not new but only got noticed now that vhost is built on more systems. This is just a question of __user tags missing in a couple of places, so fix it up.

Fixes f88949138058 ("vhost: introduce O(1) vq metadata cache")
---
 drivers/vhost/vhost.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/vhost/vhost.c +2 -2
index d450e16c5c25..21a59b598ed8 100644
@@ -730,7 +730,7 @@ static inline void __user *vhost_vq_meta_fetch(struct vhost_virtqueue *vq,
 	if (!map)
 		return NULL;
 
-	return (void *)(uintptr_t)(map->addr + addr - map->start);
+	return (void __user *)(uintptr_t)(map->addr + addr - map->start);
 }
 
 /* Can we switch to this memory table? */
@@ -869,7 +869,7 @@ static void __user *__vhost_get_user_slow(struct vhost_virtqueue *vq,
  * not happen in this case.
  */
 static inline void __user *__vhost_get_user(struct vhost_virtqueue *vq,
-					    void *addr, unsigned int size,
+					    void __user *addr, unsigned int size,
 					    int type)
 {
 	void __user *uaddr = vhost_vq_meta_fetch(vq,
Signature · 1 line
MST
Acked-by on v1 1/1
#1 lore raw
Quoted 26 lines · Michael S. Tsirkin

sparse warns about converting void * to void __user *. This is not new but only got noticed now that vhost is built on more systems. This is just a question of __user tags missing in a couple of places, so fix it up.

Fixes f88949138058 ("vhost: introduce O(1) vq metadata cache")
---
  drivers/vhost/vhost.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/vhost/vhost.c +1 -1
index d450e16c5c25..21a59b598ed8 100644
@@ -730,7 +730,7 @@ static inline void __user *vhost_vq_meta_fetch(struct vhost_virtqueue *vq,
  	if (!map)
  		return NULL;
 
-	return (void *)(uintptr_t)(map->addr + addr - map->start);
+	return (void __user *)(uintptr_t)(map->addr + addr - map->start);
  }
 
  /* Can we switch to this memory table? */

drivers/vhost/vhost.c static void __user *__vhost_get_user_slow(struct vhost_virtqueue *vq, · line 875

Quoted 8 lines
drivers/vhost/vhost.c +1 -1
@@ -869,7 +869,7 @@ static void __user *__vhost_get_user_slow(struct vhost_virtqueue *vq,
   * not happen in this case.
   */
  static inline void __user *__vhost_get_user(struct vhost_virtqueue *vq,
-					    void *addr, unsigned int size,
+					    void __user *addr, unsigned int size,
  					    int type)
  {
  	void __user *uaddr = vhost_vq_meta_fetch(vq,

_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization