All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: mst@redhat.com, jasowang@redhat.com, kvm@vger.kernel.org,
	virtualization@lists.linux-foundation.org,
	netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, kwankhede@nvidia.com,
	alex.williamson@redhat.com, cohuck@redhat.com,
	tiwei.bie@intel.com, maxime.coquelin@redhat.com,
	cunming.liang@intel.com, zhihong.wang@intel.com,
	rob.miller@broadcom.com, idos@mellanox.com,
	xiao.w.wang@intel.com, haotian.wang@sifive.com
Subject: [RFC PATCH 1/4] vringh: fix copy direction of vringh_iov_push_kern()
Date: Tue, 10 Sep 2019 16:19:32 +0800	[thread overview]
Message-ID: <20190910081935.30516-2-jasowang@redhat.com> (raw)
In-Reply-To: <20190910081935.30516-1-jasowang@redhat.com>

We want to copy from iov to buf, so the direction was wrong.

Signed-off-by: Jason Wang <jasowang@redhat.com>
---
 drivers/vhost/vringh.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/vhost/vringh.c b/drivers/vhost/vringh.c
index 08ad0d1f0476..a0a2d74967ef 100644
--- a/drivers/vhost/vringh.c
+++ b/drivers/vhost/vringh.c
@@ -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.
@@ -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);
 
-- 
2.19.1


WARNING: multiple messages have this Message-ID (diff)
From: Jason Wang <jasowang@redhat.com>
To: mst@redhat.com, jasowang@redhat.com, kvm@vger.kernel.org,
	virtualization@lists.linux-foundation.org,
	netdev@vger.kernel.org
Cc: idos@mellanox.com, cohuck@redhat.com, kwankhede@nvidia.com,
	linux-kernel@vger.kernel.org, maxime.coquelin@redhat.com,
	xiao.w.wang@intel.com, zhihong.wang@intel.com,
	haotian.wang@sifive.com, rob.miller@broadcom.com
Subject: [RFC PATCH 1/4] vringh: fix copy direction of vringh_iov_push_kern()
Date: Tue, 10 Sep 2019 16:19:32 +0800	[thread overview]
Message-ID: <20190910081935.30516-2-jasowang@redhat.com> (raw)
In-Reply-To: <20190910081935.30516-1-jasowang@redhat.com>

We want to copy from iov to buf, so the direction was wrong.

Signed-off-by: Jason Wang <jasowang@redhat.com>
---
 drivers/vhost/vringh.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/vhost/vringh.c b/drivers/vhost/vringh.c
index 08ad0d1f0476..a0a2d74967ef 100644
--- a/drivers/vhost/vringh.c
+++ b/drivers/vhost/vringh.c
@@ -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.
@@ -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);
 
-- 
2.19.1

  reply	other threads:[~2019-09-10  8:20 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-10  8:19 [RFC PATCH 0/4] mdev based hardware virtio offloading support Jason Wang
2019-09-10  8:19 ` Jason Wang [this message]
2019-09-10  8:19   ` [RFC PATCH 1/4] vringh: fix copy direction of vringh_iov_push_kern() Jason Wang
2019-09-10  8:19 ` [RFC PATCH 2/4] mdev: introduce helper to set per device dma ops Jason Wang
2019-09-10  8:19 ` Jason Wang
2019-09-17 19:00   ` Alex Williamson
2019-09-18  5:58     ` Jason Wang
2019-09-18  5:58     ` Jason Wang
2019-09-17 19:00   ` Alex Williamson
2019-09-10  8:19 ` [RFC PATCH 3/4] virtio: introudce a mdev based transport Jason Wang
2019-09-10  8:19   ` Jason Wang
2019-09-10 10:01   ` Michael S. Tsirkin
2019-09-10 10:01   ` Michael S. Tsirkin
2019-09-10 13:13     ` Jason Wang
2019-09-10 13:13     ` Jason Wang
2019-09-10 13:52       ` Michael S. Tsirkin
2019-09-11  2:38         ` Jason Wang
2019-09-11  2:38         ` Jason Wang
2019-09-11  9:36           ` Michael S. Tsirkin
2019-09-11  9:36           ` Michael S. Tsirkin
2019-09-11  9:53             ` Jason Wang
2019-09-11  9:53             ` Jason Wang
2019-09-10 13:52       ` Michael S. Tsirkin
2019-09-11  1:47   ` Tiwei Bie
2019-09-11  1:47     ` Tiwei Bie
2019-09-11  2:52     ` Jason Wang
2019-09-11  3:08       ` Tiwei Bie
2019-09-11  3:08         ` Tiwei Bie
2019-09-11  2:52     ` Jason Wang
2019-09-10  8:19 ` [RFC PATCH 4/4] docs: Sample driver to demonstrate how to implement virtio-mdev framework Jason Wang
2019-09-10  8:19 ` Jason Wang
2019-09-10 10:15   ` Michael S. Tsirkin
2019-09-10 10:15   ` Michael S. Tsirkin
2019-09-10 13:22     ` Jason Wang
2019-09-10 13:22     ` Jason Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190910081935.30516-2-jasowang@redhat.com \
    --to=jasowang@redhat.com \
    --cc=alex.williamson@redhat.com \
    --cc=cohuck@redhat.com \
    --cc=cunming.liang@intel.com \
    --cc=haotian.wang@sifive.com \
    --cc=idos@mellanox.com \
    --cc=kvm@vger.kernel.org \
    --cc=kwankhede@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maxime.coquelin@redhat.com \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=rob.miller@broadcom.com \
    --cc=tiwei.bie@intel.com \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=xiao.w.wang@intel.com \
    --cc=zhihong.wang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.