Skip to content

Commit a8d3782

Browse files
Christoph Hellwigmstsirkin
authored andcommitted
vhost: fix sparse warnings
Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Michael S. Tsirkin <[email protected]>
1 parent 179b284 commit a8d3782

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

drivers/vhost/net.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,7 @@ static struct miscdevice vhost_net_misc = {
641641
&vhost_net_fops,
642642
};
643643

644-
int vhost_net_init(void)
644+
static int vhost_net_init(void)
645645
{
646646
int r = vhost_init();
647647
if (r)
@@ -658,7 +658,7 @@ int vhost_net_init(void)
658658
}
659659
module_init(vhost_net_init);
660660

661-
void vhost_net_exit(void)
661+
static void vhost_net_exit(void)
662662
{
663663
misc_deregister(&vhost_net_misc);
664664
vhost_cleanup();

drivers/vhost/vhost.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -714,8 +714,8 @@ int vhost_log_write(struct vhost_virtqueue *vq, struct vhost_log *log,
714714
return 0;
715715
}
716716

717-
int translate_desc(struct vhost_dev *dev, u64 addr, u32 len,
718-
struct iovec iov[], int iov_size)
717+
static int translate_desc(struct vhost_dev *dev, u64 addr, u32 len,
718+
struct iovec iov[], int iov_size)
719719
{
720720
const struct vhost_memory_region *reg;
721721
struct vhost_memory *mem;
@@ -740,7 +740,7 @@ int translate_desc(struct vhost_dev *dev, u64 addr, u32 len,
740740
_iov = iov + ret;
741741
size = reg->memory_size - addr + reg->guest_phys_addr;
742742
_iov->iov_len = min((u64)len, size);
743-
_iov->iov_base = (void *)(unsigned long)
743+
_iov->iov_base = (void __user *)(unsigned long)
744744
(reg->userspace_addr + addr - reg->guest_phys_addr);
745745
s += size;
746746
addr += size;
@@ -994,7 +994,7 @@ void vhost_discard_vq_desc(struct vhost_virtqueue *vq)
994994
* want to notify the guest, using eventfd. */
995995
int vhost_add_used(struct vhost_virtqueue *vq, unsigned int head, int len)
996996
{
997-
struct vring_used_elem *used;
997+
struct vring_used_elem __user *used;
998998

999999
/* The virtqueue contains a ring of used buffers. Get a pointer to the
10001000
* next entry in that used ring. */
@@ -1018,7 +1018,8 @@ int vhost_add_used(struct vhost_virtqueue *vq, unsigned int head, int len)
10181018
smp_wmb();
10191019
/* Log used ring entry write. */
10201020
log_write(vq->log_base,
1021-
vq->log_addr + ((void *)used - (void *)vq->used),
1021+
vq->log_addr +
1022+
((void __user *)used - (void __user *)vq->used),
10221023
sizeof *used);
10231024
/* Log used index update. */
10241025
log_write(vq->log_base,

0 commit comments

Comments
 (0)