All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] vringh: fix copy direction of vringh_iov_push_kern()
@ 2019-10-24  3:57 Jason Wang
  2019-10-27 10:04 ` Michael S. Tsirkin
  2019-10-27 10:04 ` Michael S. Tsirkin
  0 siblings, 2 replies; 5+ messages in thread
From: Jason Wang @ 2019-10-24  3:57 UTC (permalink / raw)
  To: mst, jasowang, kvm, virtualization, netdev, linux-kernel

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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next] vringh: fix copy direction of vringh_iov_push_kern()
  2019-10-24  3:57 [PATCH net-next] vringh: fix copy direction of vringh_iov_push_kern() Jason Wang
@ 2019-10-27 10:04 ` Michael S. Tsirkin
  2019-10-28  3:52   ` Jason Wang
  2019-10-28  3:52   ` Jason Wang
  2019-10-27 10:04 ` Michael S. Tsirkin
  1 sibling, 2 replies; 5+ messages in thread
From: Michael S. Tsirkin @ 2019-10-27 10:04 UTC (permalink / raw)
  To: Jason Wang; +Cc: kvm, virtualization, netdev, linux-kernel

On Thu, Oct 24, 2019 at 11:57:18AM +0800, Jason Wang wrote:
> 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>

I'm still inclined to merge it now, incorrect code tends to
proliferate.

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next] vringh: fix copy direction of vringh_iov_push_kern()
  2019-10-24  3:57 [PATCH net-next] vringh: fix copy direction of vringh_iov_push_kern() Jason Wang
  2019-10-27 10:04 ` Michael S. Tsirkin
@ 2019-10-27 10:04 ` Michael S. Tsirkin
  1 sibling, 0 replies; 5+ messages in thread
From: Michael S. Tsirkin @ 2019-10-27 10:04 UTC (permalink / raw)
  To: Jason Wang; +Cc: netdev, linux-kernel, kvm, virtualization

On Thu, Oct 24, 2019 at 11:57:18AM +0800, Jason Wang wrote:
> 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>

I'm still inclined to merge it now, incorrect code tends to
proliferate.

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next] vringh: fix copy direction of vringh_iov_push_kern()
  2019-10-27 10:04 ` Michael S. Tsirkin
@ 2019-10-28  3:52   ` Jason Wang
  2019-10-28  3:52   ` Jason Wang
  1 sibling, 0 replies; 5+ messages in thread
From: Jason Wang @ 2019-10-28  3:52 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: kvm, virtualization, netdev, linux-kernel


On 2019/10/27 下午6:04, Michael S. Tsirkin wrote:
> On Thu, Oct 24, 2019 at 11:57:18AM +0800, Jason Wang wrote:
>> 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>
> I'm still inclined to merge it now, incorrect code tends to
> proliferate.


I'm fine with this, so I believe you will merge this patch?

Thanks


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next] vringh: fix copy direction of vringh_iov_push_kern()
  2019-10-27 10:04 ` Michael S. Tsirkin
  2019-10-28  3:52   ` Jason Wang
@ 2019-10-28  3:52   ` Jason Wang
  1 sibling, 0 replies; 5+ messages in thread
From: Jason Wang @ 2019-10-28  3:52 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: netdev, linux-kernel, kvm, virtualization


On 2019/10/27 下午6:04, Michael S. Tsirkin wrote:
> On Thu, Oct 24, 2019 at 11:57:18AM +0800, Jason Wang wrote:
>> 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>
> I'm still inclined to merge it now, incorrect code tends to
> proliferate.


I'm fine with this, so I believe you will merge this patch?

Thanks


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

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-10-28  3:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-24  3:57 [PATCH net-next] vringh: fix copy direction of vringh_iov_push_kern() Jason Wang
2019-10-27 10:04 ` Michael S. Tsirkin
2019-10-28  3:52   ` Jason Wang
2019-10-28  3:52   ` Jason Wang
2019-10-27 10:04 ` Michael S. Tsirkin

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.