Skip to content

Commit 7371335

Browse files
Zhi Yong Wudavem330
authored andcommitted
tun: remove useless codes in tun_chr_aio_read() and tun_recvmsg()
By checking related codes, it is impossible that ret > len or total_len, so we should remove some useless codes in both above functions. Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 41e4af6 commit 7371335

File tree

1 file changed

+0
-5
lines changed

1 file changed

+0
-5
lines changed

drivers/net/tun.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1354,7 +1354,6 @@ static ssize_t tun_chr_aio_read(struct kiocb *iocb, const struct iovec *iv,
13541354

13551355
ret = tun_do_read(tun, tfile, iv, len,
13561356
file->f_flags & O_NONBLOCK);
1357-
ret = min_t(ssize_t, ret, len);
13581357
if (ret > 0)
13591358
iocb->ki_pos = ret;
13601359
out:
@@ -1455,10 +1454,6 @@ static int tun_recvmsg(struct kiocb *iocb, struct socket *sock,
14551454
}
14561455
ret = tun_do_read(tun, tfile, m->msg_iov, total_len,
14571456
flags & MSG_DONTWAIT);
1458-
if (ret > total_len) {
1459-
m->msg_flags |= MSG_TRUNC;
1460-
ret = flags & MSG_TRUNC ? ret : total_len;
1461-
}
14621457
out:
14631458
tun_put(tun);
14641459
return ret;

0 commit comments

Comments
 (0)