diff options
author | Zhi Yong Wu <wuzhy@linux.vnet.ibm.com> | 2013-12-06 15:54:59 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-12-09 20:35:42 -0500 |
commit | 41e4af69a5984a3193ba3108fb4e067b0e34dc73 (patch) | |
tree | 8f0ab590e83d6a9fc0e550dcebf71bb1f435aaa1 | |
parent | ca2f09f2b2c6c25047cfc545d057c4edfcfe561c (diff) |
macvtap: remove useless codes in macvtap_aio_read() and macvtap_recvmsg()
By checking related codes, it is impossible that ret > len or total_len,
so we should remove some useless coeds in both above functions.
Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/macvtap.c | 5 |
1 files changed, 0 insertions, 5 deletions
diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c index 4a34bcb6549f..2aa5e973ef17 100644 --- a/drivers/net/macvtap.c +++ b/drivers/net/macvtap.c | |||
@@ -871,7 +871,6 @@ static ssize_t macvtap_aio_read(struct kiocb *iocb, const struct iovec *iv, | |||
871 | } | 871 | } |
872 | 872 | ||
873 | ret = macvtap_do_read(q, iv, len, file->f_flags & O_NONBLOCK); | 873 | ret = macvtap_do_read(q, iv, len, file->f_flags & O_NONBLOCK); |
874 | ret = min_t(ssize_t, ret, len); /* XXX copied from tun.c. Why? */ | ||
875 | if (ret > 0) | 874 | if (ret > 0) |
876 | iocb->ki_pos = ret; | 875 | iocb->ki_pos = ret; |
877 | out: | 876 | out: |
@@ -1106,10 +1105,6 @@ static int macvtap_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
1106 | return -EINVAL; | 1105 | return -EINVAL; |
1107 | ret = macvtap_do_read(q, m->msg_iov, total_len, | 1106 | ret = macvtap_do_read(q, m->msg_iov, total_len, |
1108 | flags & MSG_DONTWAIT); | 1107 | flags & MSG_DONTWAIT); |
1109 | if (ret > total_len) { | ||
1110 | m->msg_flags |= MSG_TRUNC; | ||
1111 | ret = flags & MSG_TRUNC ? ret : total_len; | ||
1112 | } | ||
1113 | return ret; | 1108 | return ret; |
1114 | } | 1109 | } |
1115 | 1110 | ||