From: William Allen Simpson <william.allen.simpson@gmail.com>
To: akpm@linux-foundation.org
Cc: mm-commits@vger.kernel.org, davem@davemloft.net,
Linux Kernel Network Developers <netdev@vger.kernel.org>
Subject: Re: + net-ipv4-tcpc-fix-warning.patch added to -mm tree
Date: Tue, 08 Dec 2009 20:45:53 -0500 [thread overview]
Message-ID: <4B1F0151.10903@gmail.com> (raw)
In-Reply-To: <200912090045.nB90jTaO010647@imap1.linux-foundation.org>
akpm@linux-foundation.org wrote:
> The patch titled
> net/ipv4/tcp.c: fix warning
> has been added to the -mm tree. Its filename is
> net-ipv4-tcpc-fix-warning.patch
>
> Before you just go and hit "reply", please:
> a) Consider who else should be cc'ed
> b) Prefer to cc a suitable mailing list as well
> c) Ideally: find the original patch on the mailing list and do a
> reply-to-all to that, adding suitable additional cc's
>
> *** Remember to use Documentation/SubmitChecklist when testing your code ***
>
> See http://userweb.kernel.org/~akpm/stuff/added-to-mm.txt to find
> out what to do about this
>
> The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/
>
> ------------------------------------------------------
> Subject: net/ipv4/tcp.c: fix warning
> From: Andrew Morton <akpm@linux-foundation.org>
>
> x86_64 allmodconfig:
>
> net/ipv4/tcp.c: In function 'do_tcp_getsockopt':
> net/ipv4/tcp.c:2544: warning: comparison is always false due to limited range of data type
>
> sizeof(tcpct_value) is 536, which can never be less than a value which is held
> in a u8.
>
> This fix is stupid - just delete the code?
>
I didn't have this warning, how in the world do you get it?
This is what David calls my "anal" coding style. I check everything,
because someday somebody else might make a change, and it's important
that such problems be detected. In this case, I assume the compiler
will compile them out or it would have no effect, and commented that
it should be impossible.
Your test should probably be TCP_MSS_DEFAULT < TCP_COOKIE_PAIR_SIZE
> btw, what does "return as nonce" try to mean?
>
The internet-draft specifies returning a nonce.
> Cc: David S. Miller <davem@davemloft.net>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: William Allen Simpson <william.allen.simpson@gmail.com>
> ---
>
> net/ipv4/tcp.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff -puN net/ipv4/tcp.c~net-ipv4-tcpc-fix-warning net/ipv4/tcp.c
> --- a/net/ipv4/tcp.c~net-ipv4-tcpc-fix-warning
> +++ a/net/ipv4/tcp.c
> @@ -2540,11 +2540,13 @@ static int do_tcp_getsockopt(struct sock
> ctd.tcpct_cookie_desired = cvp->cookie_desired;
> ctd.tcpct_s_data_desired = cvp->s_data_desired;
>
> +#if TCP_MSS_DEFAULT < 256
> /* Cookie(s) saved, return as nonce */
> if (sizeof(ctd.tcpct_value) < cvp->cookie_pair_size) {
> /* impossible? */
> return -EINVAL;
> }
> +#endif
> memcpy(&ctd.tcpct_value[0], &cvp->cookie_pair[0],
> cvp->cookie_pair_size);
> ctd.tcpct_used = cvp->cookie_pair_size;
> _
next parent reply other threads:[~2009-12-09 1:45 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <200912090045.nB90jTaO010647@imap1.linux-foundation.org>
2009-12-09 1:45 ` William Allen Simpson [this message]
2009-12-09 2:08 ` + net-ipv4-tcpc-fix-warning.patch added to -mm tree Andrew Morton
2009-12-09 4:07 ` David Miller
2009-12-10 13:48 ` William Allen Simpson
2009-12-10 14:16 ` [PATCH] net-ipv4-tcp.c-fix-warning-from-older-compilers.patch William Allen Simpson
2009-12-10 14:31 ` Ben Hutchings
2009-12-11 15:30 ` William Allen Simpson
2009-12-11 15:38 ` [PATCH v2] net-ipv4-tcp.c-fix-warning-for-older-compilers.patch William Allen Simpson
2009-12-10 15:31 ` [PATCH] net-ipv4-tcp.c-fix-warning-from-older-compilers.patch Eric Dumazet
2009-12-10 21:46 ` David Miller
2009-12-11 6:50 ` Jarek Poplawski
2009-12-11 15:51 ` William Allen Simpson
2009-12-11 19:25 ` Jarek Poplawski
2009-12-11 22:25 ` David Miller
2009-12-11 15:49 ` William Allen Simpson
2009-12-11 22:24 ` David Miller
2009-12-10 21:43 ` 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=4B1F0151.10903@gmail.com \
--to=william.allen.simpson@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=davem@davemloft.net \
--cc=mm-commits@vger.kernel.org \
--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).