Skip to content

Commit

Permalink
vringh: fix copy direction of vringh_iov_push_kern()
Browse files Browse the repository at this point in the history
We want to copy from iov to buf, so the direction was wrong.

Note: no real user for the helper, but it will be used by future
features.

Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
  • Loading branch information
Jason Wang authored and Michael S. Tsirkin committed Oct 28, 2019
1 parent 6771596 commit b3683de
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion drivers/vhost/vringh.c
Original file line number Diff line number Diff line change
Expand Up @@ -852,6 +852,12 @@ static inline int xfer_kern(void *src, void *dst, size_t len)
return 0;
}

static inline int kern_xfer(void *dst, void *src, size_t len)
{
memcpy(dst, src, len);
return 0;
}

/**
* vringh_init_kern - initialize a vringh for a kernelspace vring.
* @vrh: the vringh to initialize.
Expand Down Expand Up @@ -958,7 +964,7 @@ EXPORT_SYMBOL(vringh_iov_pull_kern);
ssize_t vringh_iov_push_kern(struct vringh_kiov *wiov,
const void *src, size_t len)
{
return vringh_iov_xfer(wiov, (void *)src, len, xfer_kern);
return vringh_iov_xfer(wiov, (void *)src, len, kern_xfer);
}
EXPORT_SYMBOL(vringh_iov_push_kern);

Expand Down

0 comments on commit b3683de

Please sign in to comment.