Re: [PATCH V2] auxdisplay: use correct string length
From: Arnd Bergmann
Date: Tue Feb 13 2018 - 03:28:27 EST
On Tue, Feb 13, 2018 at 8:23 AM, Willy Tarreau <w@xxxxxx> wrote:
> On Tue, Feb 13, 2018 at 09:19:21AM +0800, Xiongfeng Wang wrote:
>> This may suppress the gcc warning.
>
> In fact there are two big problems with gcc warnings :
> - writing -Wno-something-unknown triggers an error on versions where
> "something-unknown" isn't known, making it difficult to permanently
> disable warnings (though in the kernel we handle this pretty fine)
We have the $(call cc-disable-warning) helper for this.
> - warnings and diagnostics are conflated. Some warnings should only be
> provided when the developer explicitly asks for suspicious stuff
> (-Wsecurity, -Wsuspicious, etc) that would *not* be part of -Wall
> since -Wall is usually used to report real warnings.
And this is what the W=1 and W=2 make options are for.
I originally asked Xiongfeng to look at some of the new gcc-8 warnings,
but must have miscommunicated at some point. I think we do want to
enable the new -Wstringop-overflow warnings by default and fix all
instances, including the false-positive ones. This is a useful warning
because it tells you when you actually write past a buffer, e.g. using
strcpy() with a source string that is longer than the destination.
For -Wstringop-truncation, we can decide whether it should be W=1
or W=2, but I'd still make it possible for users and maintainers to
easily enable the warning when test building new code.
Arnd