Netdev List
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: arnd@arndb.de
Cc: kuznet@ms2.inr.ac.ru, yoshfuji@linux-ipv6.org,
	edumazet@google.com, ncardwell@google.com, soheil@google.com,
	ycheng@google.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net] tcp: avoid bogus gcc-7 array-bounds warning
Date: Sat, 29 Jul 2017 23:27:43 -0700 (PDT)	[thread overview]
Message-ID: <20170729.232743.2176188817187533294.davem@davemloft.net> (raw)
In-Reply-To: <20170728144153.2024234-1-arnd@arndb.de>

From: Arnd Bergmann <arnd@arndb.de>
Date: Fri, 28 Jul 2017 16:41:37 +0200

> When using CONFIG_UBSAN_SANITIZE_ALL, the TCP code produces a
> false-positive warning:
> 
> net/ipv4/tcp_output.c: In function 'tcp_connect':
> net/ipv4/tcp_output.c:2207:40: error: array subscript is below array bounds [-Werror=array-bounds]
>    tp->chrono_stat[tp->chrono_type - 1] += now - tp->chrono_start;
>                                         ^~
> net/ipv4/tcp_output.c:2207:40: error: array subscript is below array bounds [-Werror=array-bounds]
>    tp->chrono_stat[tp->chrono_type - 1] += now - tp->chrono_start;
>    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
> 
> I have opened a gcc bug for this, but distros have already shipped
> compilers with this problem, and it's not clear yet whether there is
> a way for gcc to avoid the warning. As the problem is related to the
> bitfield access, this introduces a temporary variable to store the old
> enum value.
> 
> I did not notice this warning earlier, since UBSAN is disabled when
> building with COMPILE_TEST, and that was always turned on in both
> allmodconfig and randconfig tests.
> 
> Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81601
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Applied, thanks Arnd.

      parent reply	other threads:[~2017-07-30  6:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-28 14:41 [PATCH net] tcp: avoid bogus gcc-7 array-bounds warning Arnd Bergmann
2017-07-28 15:39 ` David Laight
2017-07-30  6:27 ` David Miller [this message]

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=20170729.232743.2176188817187533294.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=arnd@arndb.de \
    --cc=edumazet@google.com \
    --cc=kuznet@ms2.inr.ac.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ncardwell@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=soheil@google.com \
    --cc=ycheng@google.com \
    --cc=yoshfuji@linux-ipv6.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