From: Joe Perches <joe@perches.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: "David Miller" <davem@davemloft.net>,
netdev <netdev@vger.kernel.org>,
"Michał Mirosław" <mirq-linux@rere.qmqm.pl>
Subject: Re: [PATCH net-next] tcp: tcp_sendmsg() wrong access to sk_route_caps
Date: Mon, 28 Nov 2011 02:46:37 -0800 [thread overview]
Message-ID: <1322477197.2024.4.camel@Joe-Laptop> (raw)
In-Reply-To: <1322476067.2292.12.camel@edumazet-HP-Compaq-6005-Pro-SFF-PC>
On Mon, 2011-11-28 at 11:27 +0100, Eric Dumazet wrote:
> Now sk_route_caps is u64, its dangerous to use an integer to store
> result of an AND operator. It wont work if NETIF_F_SG is moved on the
> upper part of u64.
trivial comment below.
> diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
[]
> @@ -917,9 +917,9 @@ int tcp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
> struct iovec *iov;
> struct tcp_sock *tp = tcp_sk(sk);
> struct sk_buff *skb;
> - int iovlen, flags;
> + int iovlen, flags, err, copied;
> int mss_now, size_goal;
> - int sg, err, copied;
> + bool sg;
> long timeo;
>
> lock_sock(sk);
> @@ -946,7 +946,7 @@ int tcp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
> if (sk->sk_err || (sk->sk_shutdown & SEND_SHUTDOWN))
> goto out_err;
>
> - sg = sk->sk_route_caps & NETIF_F_SG;
> + sg = !!(sk->sk_route_caps & NETIF_F_SG);
As sg is now bool, using !! is unnecessary.
A commit was done recently to remove one.
3ad9b358e03fd9dbf6705721490c811b666b0fe2
next prev parent reply other threads:[~2011-11-28 10:46 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-28 10:27 [PATCH net-next] tcp: tcp_sendmsg() wrong access to sk_route_caps Eric Dumazet
2011-11-28 10:46 ` Joe Perches [this message]
2011-11-28 16:04 ` Eric Dumazet
2011-11-28 16:53 ` David Laight
2011-11-28 16:54 ` Joe Perches
2011-11-28 17:20 ` Ben Hutchings
2011-11-28 17:32 ` Joe Perches
2011-11-28 23:58 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1322477197.2024.4.camel@Joe-Laptop \
--to=joe@perches.com \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=mirq-linux@rere.qmqm.pl \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).