netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 2/3] net: Fix memcpy_toiovecend() to use the right offset
@ 2009-06-05 19:35 Sridhar Samudrala
  2009-06-06 21:13 ` Michael S. Tsirkin
  0 siblings, 1 reply; 3+ messages in thread
From: Sridhar Samudrala @ 2009-06-05 19:35 UTC (permalink / raw)
  To: davem, netdev, mst

Increment the iovec base by the offset passed in for the initial
copy_to_user() in memcpy_to_iovecend().

Signed-off-by: Sridhar Samudrala <sri@us.ibm.com>

diff --git a/net/core/iovec.c b/net/core/iovec.c
index 40a76ce..16ad45d 100644
--- a/net/core/iovec.c
+++ b/net/core/iovec.c
@@ -112,9 +112,9 @@ int memcpy_toiovecend(const struct iovec *iov, unsigned char *kdata,
 			continue;
 		}
 		copy = min_t(unsigned int, iov->iov_len - offset, len);
-		offset = 0;
-		if (copy_to_user(iov->iov_base, kdata, copy))
+		if (copy_to_user(iov->iov_base + offset, kdata, copy))
 			return -EFAULT;
+		offset = 0;
 		kdata += copy;
 		len -= copy;
 	}





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

* Re: [PATCH net-next 2/3] net: Fix memcpy_toiovecend() to use the right offset
  2009-06-05 19:35 [PATCH net-next 2/3] net: Fix memcpy_toiovecend() to use the right offset Sridhar Samudrala
@ 2009-06-06 21:13 ` Michael S. Tsirkin
  2009-06-08  7:28   ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Michael S. Tsirkin @ 2009-06-06 21:13 UTC (permalink / raw)
  To: Sridhar Samudrala; +Cc: davem, netdev

On Fri, Jun 05, 2009 at 12:35:44PM -0700, Sridhar Samudrala wrote:
> Increment the iovec base by the offset passed in for the initial
> copy_to_user() in memcpy_to_iovecend().
> 
> Signed-off-by: Sridhar Samudrala <sri@us.ibm.com>

Acked-by: Michael S. Tsirkin <mst@redhat.com>

> diff --git a/net/core/iovec.c b/net/core/iovec.c
> index 40a76ce..16ad45d 100644
> --- a/net/core/iovec.c
> +++ b/net/core/iovec.c
> @@ -112,9 +112,9 @@ int memcpy_toiovecend(const struct iovec *iov, unsigned char *kdata,
>  			continue;
>  		}
>  		copy = min_t(unsigned int, iov->iov_len - offset, len);
> -		offset = 0;
> -		if (copy_to_user(iov->iov_base, kdata, copy))
> +		if (copy_to_user(iov->iov_base + offset, kdata, copy))
>  			return -EFAULT;
> +		offset = 0;
>  		kdata += copy;
>  		len -= copy;
>  	}
> 
> 
> 

-- 
MST

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

* Re: [PATCH net-next 2/3] net: Fix memcpy_toiovecend() to use the right offset
  2009-06-06 21:13 ` Michael S. Tsirkin
@ 2009-06-08  7:28   ` David Miller
  0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2009-06-08  7:28 UTC (permalink / raw)
  To: mst; +Cc: sri, netdev

From: "Michael S. Tsirkin" <mst@redhat.com>
Date: Sun, 7 Jun 2009 00:13:21 +0300

> On Fri, Jun 05, 2009 at 12:35:44PM -0700, Sridhar Samudrala wrote:
>> Increment the iovec base by the offset passed in for the initial
>> copy_to_user() in memcpy_to_iovecend().
>> 
>> Signed-off-by: Sridhar Samudrala <sri@us.ibm.com>
> 
> Acked-by: Michael S. Tsirkin <mst@redhat.com>

Applied.

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

end of thread, other threads:[~2009-06-08  7:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-05 19:35 [PATCH net-next 2/3] net: Fix memcpy_toiovecend() to use the right offset Sridhar Samudrala
2009-06-06 21:13 ` Michael S. Tsirkin
2009-06-08  7:28   ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).