diff options
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/tun.c | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/drivers/net/tun.c b/drivers/net/tun.c index f8b8c71187a0..5db4df460049 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c | |||
@@ -292,17 +292,6 @@ static __inline__ ssize_t tun_get_user(struct tun_struct *tun, struct iovec *iv, | |||
292 | return count; | 292 | return count; |
293 | } | 293 | } |
294 | 294 | ||
295 | static inline size_t iov_total(const struct iovec *iv, unsigned long count) | ||
296 | { | ||
297 | unsigned long i; | ||
298 | size_t len; | ||
299 | |||
300 | for (i = 0, len = 0; i < count; i++) | ||
301 | len += iv[i].iov_len; | ||
302 | |||
303 | return len; | ||
304 | } | ||
305 | |||
306 | static ssize_t tun_chr_aio_write(struct kiocb *iocb, const struct iovec *iv, | 295 | static ssize_t tun_chr_aio_write(struct kiocb *iocb, const struct iovec *iv, |
307 | unsigned long count, loff_t pos) | 296 | unsigned long count, loff_t pos) |
308 | { | 297 | { |
@@ -313,7 +302,7 @@ static ssize_t tun_chr_aio_write(struct kiocb *iocb, const struct iovec *iv, | |||
313 | 302 | ||
314 | DBG(KERN_INFO "%s: tun_chr_write %ld\n", tun->dev->name, count); | 303 | DBG(KERN_INFO "%s: tun_chr_write %ld\n", tun->dev->name, count); |
315 | 304 | ||
316 | return tun_get_user(tun, (struct iovec *) iv, iov_total(iv, count)); | 305 | return tun_get_user(tun, (struct iovec *) iv, iov_length(iv, count)); |
317 | } | 306 | } |
318 | 307 | ||
319 | /* Put packet to the user space buffer */ | 308 | /* Put packet to the user space buffer */ |
@@ -364,7 +353,7 @@ static ssize_t tun_chr_aio_read(struct kiocb *iocb, const struct iovec *iv, | |||
364 | 353 | ||
365 | DBG(KERN_INFO "%s: tun_chr_read\n", tun->dev->name); | 354 | DBG(KERN_INFO "%s: tun_chr_read\n", tun->dev->name); |
366 | 355 | ||
367 | len = iov_total(iv, count); | 356 | len = iov_length(iv, count); |
368 | if (len < 0) | 357 | if (len < 0) |
369 | return -EINVAL; | 358 | return -EINVAL; |
370 | 359 | ||