[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <4B1F0151.10903@gmail.com>
Date: Tue, 08 Dec 2009 20:45:53 -0500
From: William Allen Simpson <william.allen.simpson@...il.com>
To: akpm@...ux-foundation.org
CC: mm-commits@...r.kernel.org, davem@...emloft.net,
Linux Kernel Network Developers <netdev@...r.kernel.org>
Subject: Re: + net-ipv4-tcpc-fix-warning.patch added to -mm tree
akpm@...ux-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@...ux-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@...emloft.net>
> Signed-off-by: Andrew Morton <akpm@...ux-foundation.org>
Acked-by: William Allen Simpson <william.allen.simpson@...il.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;
> _
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists