macvtap: remove useless codes in macvtap_aio_read() and macvtap_recvmsg()
Subsystems (3)
PATCH 1/2 macvtap: remove useless codes in macvtap_aio_read() and macvtap_recvmsg()
From: Zhi Yong Wu <[email protected]>
By checking related codes, it is impossible that ret > len or total_len, so we should remove some useless coeds in both above functions.
--- drivers/net/macvtap.c | 5 ----- 1 files changed, 0 insertions(+), 5 deletions(-)
drivers/net/macvtap.c +0 -5
@@ -871,7 +871,6 @@ static ssize_t macvtap_aio_read(struct kiocb *iocb, const struct iovec *iv, } ret =macvtap_do_read (q, iv, len, file->f_flags &O_NONBLOCK ); - ret =min_t (ssize_t, ret, len);/* XXX copied from tun.c. Why? */ out:return ret; }
@@ -1104,10 +1103,6 @@ static int macvtap_recvmsg(struct kiocb *iocb, struct socket *sock,return -EINVAL ; ret =macvtap_do_read (q, m->msg_iov, total_len, flags &MSG_DONTWAIT ); -if (ret > total_len) { - m->msg_flags |=MSG_TRUNC ; - ret = flags &MSG_TRUNC ? ret : total_len; - }return ret; }
Signature · 1 line
1.7.6.5
PATCH 2/2 tun: remove useless codes in tun_chr_aio_read() and tun_recvmsg()
From: Zhi Yong Wu <[email protected]>
By checking related codes, it is impossible that ret > len or total_len, so we should remove some useless codes in both above functions.
--- drivers/net/tun.c | 5 ----- 1 files changed, 0 insertions(+), 5 deletions(-)
drivers/net/tun.c +0 -5
@@ -1354,7 +1354,6 @@ static ssize_t tun_chr_aio_read(struct kiocb *iocb, const struct iovec *iv, ret =tun_do_read (tun, tfile, iv, len, file->f_flags &O_NONBLOCK ); - ret =min_t (ssize_t, ret, len); out:tun_put (tun);return ret;
@@ -1453,10 +1452,6 @@ static int tun_recvmsg(struct kiocb *iocb, struct socket *sock, } ret =tun_do_read (tun, tfile, m->msg_iov, total_len, flags &MSG_DONTWAIT ); -if (ret > total_len) { - m->msg_flags |=MSG_TRUNC ; - ret = flags &MSG_TRUNC ? ret : total_len; - } out:tun_put (tun);return ret;
Signature · 1 line
1.7.6.5
Quoted 4 lines · Zhi Yong Wu
From: Zhi Yong Wu <[email protected]>
By checking related codes, it is impossible that ret > len or
total_len, so we should remove some useless coeds in both above functions.
Looks like commit 6680ec68eff47d36f67b4351bc9836fd6cba9532
Author: Jason Wang <[email protected]> Date: Thu Jul 25 13:00:33 2013 +0800
tuntap: hardware vlan tx support
Introduced a change in tun_put_user() where we can never return a length longer then len or total_len. This has an effect that is now impossible to signal truncated status. It seems like a potential loss of functionality and it might make sense to restore it.
-vlad
Quoted 30 lines
Signed-off-by Zhi Yong Wu <[email protected]>--- drivers/net/macvtap.c | 5 ----- 1 files changed, 0 insertions(+), 5 deletions(-)drivers/net/macvtap.c +0
-5@@ -871,7 +871,6 @@ static ssize_t macvtap_aio_read(struct kiocb *iocb, const struct iovec *iv, } ret =macvtap_do_read (q, iv, len, file->f_flags &O_NONBLOCK ); - ret =min_t (ssize_t, ret, len);/* XXX copied from tun.c. Why? */ out:return ret; }@@ -1104,10 +1103,6 @@ static int macvtap_recvmsg(struct kiocb *iocb, struct socket *sock,return -EINVAL ; ret =macvtap_do_read (q, m->msg_iov, total_len, flags &MSG_DONTWAIT ); -if (ret > total_len) { - m->msg_flags |=MSG_TRUNC ; - ret = flags &MSG_TRUNC ? ret : total_len; - }return ret; }
Quoted 11 lines · Vlad Yasevich
Quoted 4 lines · Zhi Yong Wu
Quoted 4 lines
From: Zhi Yong Wu <[email protected]>
By checking related codes, it is impossible that ret > len or
total_len, so we should remove some useless coeds in both above functions.Looks like commit
6680ec68eff47d36f67b4351bc9836fd6cba9532Author: Jason Wang <[email protected]> Date: Thu Jul 25 13:00:33 2013 +0800tuntap: hardware vlan tx support
Quoted 7 lines
Introduced a change in
tun_put_user()where we can never return a length longer then len ortotal_len. This has an effect that is now impossible to signal truncated status. It seems like a potential loss of functionality and it might make sense to restore it.-vlad
True, will send a patch. For macvtap, we'd better also correct current behaviour to be same with tun.
Thanks
From: Zhi Yong Wu <[email protected]>
Date: Sat, 7 Dec 2013 04:54:59 +0800
Quoted 6 lines
From: Zhi Yong Wu <[email protected]>
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 <[email protected]>
Applied.
Re: [PATCH 2/2] tun: remove useless codes in tun_chr_aio_read() and tun_recvmsg()
In reply to Zhi Yong WuFrom: Zhi Yong Wu <[email protected]>
Date: Sat, 7 Dec 2013 04:55:00 +0800
Quoted 6 lines
From: Zhi Yong Wu <[email protected]>
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 <[email protected]>
Applied.
Re: [PATCH 2/2] tun: remove useless codes in tun_chr_aio_read() and tun_recvmsg()
Quoted 11 lines · David Miller
From: Zhi Yong Wu <[email protected]>
Date: Sat, 7 Dec 2013 04:55:00 +0800Quoted 6 lines
From: Zhi Yong Wu <[email protected]>
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 <[email protected]>Applied.
Wait a sec. We want to be able to return a value bigger then len to trigger a MSG_TRUNC. Jason has patches for to fix this. If you apply this, we'll have to re-introduce this code back in.
Same goes for patch 1/2.
-vlad
Quoted 5 lines
--
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
David Miller
maintainerRe: [PATCH 2/2] tun: remove useless codes in tun_chr_aio_read() and tun_recvmsg()
From: Vlad Yasevich <[email protected]>
Date: Tue, 10 Dec 2013 12:18:09 -0500
Quoted 11 lines · David Miller
Quoted 10 lines
From: Zhi Yong Wu <[email protected]>
Date: Sat, 7 Dec 2013 04:55:00 +0800Quoted 6 lines
From: Zhi Yong Wu <[email protected]>
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 <[email protected]>
Quoted 7 lines
Quoted 1 line
Applied.
Wait a sec. We want to be able to return a value bigger then len to trigger a
MSG_TRUNC. Jason has patches for to fix this. If you apply this, we'll have to re-introduce this code back in.Same goes for patch 1/2.
That's fine, right now the code makes no sense as the condition can never be triggered so there is no harm removing the illogical code meanwhile.
Re: [PATCH 2/2] tun: remove useless codes in tun_chr_aio_read() and tun_recvmsg()
Only one reminder, since David has committed the two patches, you maybe need to take their impact on your patches into account.
Quoted 25 lines · David Miller
From: Vlad Yasevich <[email protected]>
Date: Tue, 10 Dec 2013 12:18:09 -0500Quoted 11 lines · David Miller
Quoted 10 lines
From: Zhi Yong Wu <[email protected]>
Date: Sat, 7 Dec 2013 04:55:00 +0800Quoted 6 lines
From: Zhi Yong Wu <[email protected]>
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 <[email protected]>Quoted 7 lines
Quoted 1 line
Applied.
Wait a sec. We want to be able to return a value bigger then len to trigger a
MSG_TRUNC. Jason has patches for to fix this. If you apply this, we'll have to re-introduce this code back in.Same goes for patch 1/2.
That's fine, right now the code makes no sense as the condition can never be triggered so there is no harm removing the illogical code meanwhile.
Signature · 3 lines
Regards, Zhi Yong Wu
David Miller
maintainerRe: [PATCH 2/2] tun: remove useless codes in tun_chr_aio_read() and tun_recvmsg()
From: Zhi Yong Wu <[email protected]>
Date: Wed, 11 Dec 2013 11:14:04 +0800
Quoted 2 lines
Only one reminder, since David has committed the two patches, you maybe need to take their impact on your patches into account.
I reverted these changes from net-next.
Re: [PATCH 2/2] tun: remove useless codes in tun_chr_aio_read() and tun_recvmsg()
Quoted 7 lines · David Miller
From: Zhi Yong Wu <[email protected]>
Date: Wed, 11 Dec 2013 11:14:04 +0800Quoted 2 lines
Only one reminder, since David has committed the two patches, you maybe need to take their impact on your patches into account.
I reverted these changes from net-next.
So rapid:), thanks for your reminder.
Signature · 3 lines
Regards, Zhi Yong Wu