[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20170729.232743.2176188817187533294.davem@davemloft.net>
Date: Sat, 29 Jul 2017 23:27:43 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: arnd@...db.de
Cc: kuznet@....inr.ac.ru, yoshfuji@...ux-ipv6.org, edumazet@...gle.com,
ncardwell@...gle.com, soheil@...gle.com, ycheng@...gle.com,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH net] tcp: avoid bogus gcc-7 array-bounds warning
From: Arnd Bergmann <arnd@...db.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@...db.de>
Applied, thanks Arnd.
Powered by blists - more mailing lists