* Re: + kbuild-disable-wformat-truncation-warnings-by-default.patch added to -mm tree [not found] <596fd414.fDkQ2LPtuAl0Zq0f%akpm@linux-foundation.org> @ 2017-07-20 7:24 ` Arnd Bergmann 2017-07-20 8:17 ` gregkh 2017-08-20 13:19 ` Masahiro Yamada 0 siblings, 2 replies; 6+ messages in thread From: Arnd Bergmann @ 2017-07-20 7:24 UTC (permalink / raw) To: Andrew Morton Cc: mm-commits, Linus Torvalds, Linux Kernel Mailing List, Linux Kbuild mailing list, stable, gregkh On Wed, Jul 19, 2017 at 11:50 PM, <akpm@linux-foundation.org> wrote: > ------------------------------------------------------ > From: Arnd Bergmann <arnd@arndb.de> > Subject: kbuild: disable -Wformat-truncation warnings by default > > With x86 allmodconfig, we currently get 233 -Wformat-truncation warnings, > which makes the entire warnings rather useless. > > This turns off the warning by default, unless we specify W=1 or higher > > Link: http://lkml.kernel.org/r/20170714120720.906842-2-arnd@arndb.de > Signed-off-by: Arnd Bergmann <arnd@arndb.de> > Signed-off-by: Andrew Morton <akpm@linux-foundation.org> > --- > > scripts/Makefile.extrawarn | 3 +++ > 1 file changed, 3 insertions(+) > > diff -puN scripts/Makefile.extrawarn~kbuild-disable-wformat-truncation-warnings-by-default scripts/Makefile.extrawarn > --- a/scripts/Makefile.extrawarn~kbuild-disable-wformat-truncation-warnings-by-default > +++ a/scripts/Makefile.extrawarn > @@ -67,5 +67,8 @@ KBUILD_CFLAGS += $(call cc-disable-warni > KBUILD_CFLAGS += $(call cc-disable-warning, sign-compare) > KBUILD_CFLAGS += $(call cc-disable-warning, format-zero-length) > KBUILD_CFLAGS += $(call cc-disable-warning, uninitialized) > +else > +# noisy gcc-7 warnings > +KBUILD_CFLAGS += $(call cc-option,-Wformat-truncation=0) > endif > endif Hi Andrew, Linus, Greg, I noticed that Linus has made a similar patch in 4.13-rc1, commit bd664f6b3e37 ("disable new gcc-7.1.1 warnings for now"), and it completely disables three warnings (format-truncation, format-overflow and int-in-bool-context). Obviously there is no point in having both, so let's talk about what we want for 4.13, stable-backports and for future kernels, I'll then send those patches. Here is my first suggestion: - enable all three warnings with "make W=1" in 4.13, but leave them disabled by default. - backport Linus' patch, plus the follow-up for W=1 to stable kernels, to allow stable kernels to build cleanly - backport the patches that address any other gcc-7 warnings, as well as those that are not obvious false-positives to stable kernels - In 4.14+, use my version above and address all int-in-bool-context and format-overflow warnings, but only use -Wformat-truncation with make W=1. Any other suggestions? Arnd ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: + kbuild-disable-wformat-truncation-warnings-by-default.patch added to -mm tree 2017-07-20 7:24 ` + kbuild-disable-wformat-truncation-warnings-by-default.patch added to -mm tree Arnd Bergmann @ 2017-07-20 8:17 ` gregkh 2017-07-20 10:41 ` Arnd Bergmann 2017-08-20 13:19 ` Masahiro Yamada 1 sibling, 1 reply; 6+ messages in thread From: gregkh @ 2017-07-20 8:17 UTC (permalink / raw) To: Arnd Bergmann Cc: Andrew Morton, mm-commits, Linus Torvalds, Linux Kernel Mailing List, Linux Kbuild mailing list, stable On Thu, Jul 20, 2017 at 09:24:21AM +0200, Arnd Bergmann wrote: > On Wed, Jul 19, 2017 at 11:50 PM, <akpm@linux-foundation.org> wrote: > > ------------------------------------------------------ > > From: Arnd Bergmann <arnd@arndb.de> > > Subject: kbuild: disable -Wformat-truncation warnings by default > > > > With x86 allmodconfig, we currently get 233 -Wformat-truncation warnings, > > which makes the entire warnings rather useless. > > > > This turns off the warning by default, unless we specify W=1 or higher > > > > Link: http://lkml.kernel.org/r/20170714120720.906842-2-arnd@arndb.de > > Signed-off-by: Arnd Bergmann <arnd@arndb.de> > > Signed-off-by: Andrew Morton <akpm@linux-foundation.org> > > --- > > > > scripts/Makefile.extrawarn | 3 +++ > > 1 file changed, 3 insertions(+) > > > > diff -puN scripts/Makefile.extrawarn~kbuild-disable-wformat-truncation-warnings-by-default scripts/Makefile.extrawarn > > --- a/scripts/Makefile.extrawarn~kbuild-disable-wformat-truncation-warnings-by-default > > +++ a/scripts/Makefile.extrawarn > > @@ -67,5 +67,8 @@ KBUILD_CFLAGS += $(call cc-disable-warni > > KBUILD_CFLAGS += $(call cc-disable-warning, sign-compare) > > KBUILD_CFLAGS += $(call cc-disable-warning, format-zero-length) > > KBUILD_CFLAGS += $(call cc-disable-warning, uninitialized) > > +else > > +# noisy gcc-7 warnings > > +KBUILD_CFLAGS += $(call cc-option,-Wformat-truncation=0) > > endif > > endif > > Hi Andrew, Linus, Greg, > > I noticed that Linus has made a similar patch in 4.13-rc1, commit bd664f6b3e37 > ("disable new gcc-7.1.1 warnings for now"), and it completely disables three > warnings (format-truncation, format-overflow and int-in-bool-context). > > Obviously there is no point in having both, so let's talk about what we > want for 4.13, stable-backports and for future kernels, I'll then send those > patches. Here is my first suggestion: > > - enable all three warnings with "make W=1" in 4.13, but leave them > disabled by default. > - backport Linus' patch, plus the follow-up for W=1 to stable kernels, > to allow stable kernels to build cleanly I don't care which of these, I'll take whatever is in Linus's tree. And I'll go backport that patch now as I'm getting annoyed by the warnings at the moment... > - backport the patches that address any other gcc-7 warnings, as > well as those that are not obvious false-positives to stable kernels I'll do that as well, as I notice them go by. > - In 4.14+, use my version above and address all int-in-bool-context > and format-overflow warnings, but only use -Wformat-truncation > with make W=1. I don't really care about this, as long as we are not forced to do "silly things" like some of the patches seemed to do :) thanks, greg k-h ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: + kbuild-disable-wformat-truncation-warnings-by-default.patch added to -mm tree 2017-07-20 8:17 ` gregkh @ 2017-07-20 10:41 ` Arnd Bergmann 0 siblings, 0 replies; 6+ messages in thread From: Arnd Bergmann @ 2017-07-20 10:41 UTC (permalink / raw) To: gregkh Cc: Andrew Morton, mm-commits, Linus Torvalds, Linux Kernel Mailing List, Linux Kbuild mailing list, stable On Thu, Jul 20, 2017 at 10:17 AM, gregkh <gregkh@linuxfoundation.org> wrote: > On Thu, Jul 20, 2017 at 09:24:21AM +0200, Arnd Bergmann wrote: >> On Wed, Jul 19, 2017 at 11:50 PM, <akpm@linux-foundation.org> wrote: >> > ------------------------------------------------------ >> > From: Arnd Bergmann <arnd@arndb.de> >> > Subject: kbuild: disable -Wformat-truncation warnings by default >> > >> > With x86 allmodconfig, we currently get 233 -Wformat-truncation warnings, >> > which makes the entire warnings rather useless. >> > >> > This turns off the warning by default, unless we specify W=1 or higher >> > >> > Link: http://lkml.kernel.org/r/20170714120720.906842-2-arnd@arndb.de >> > Signed-off-by: Arnd Bergmann <arnd@arndb.de> >> > Signed-off-by: Andrew Morton <akpm@linux-foundation.org> >> > --- >> > >> > scripts/Makefile.extrawarn | 3 +++ >> > 1 file changed, 3 insertions(+) >> > >> > diff -puN scripts/Makefile.extrawarn~kbuild-disable-wformat-truncation-warnings-by-default scripts/Makefile.extrawarn >> > --- a/scripts/Makefile.extrawarn~kbuild-disable-wformat-truncation-warnings-by-default >> > +++ a/scripts/Makefile.extrawarn >> > @@ -67,5 +67,8 @@ KBUILD_CFLAGS += $(call cc-disable-warni >> > KBUILD_CFLAGS += $(call cc-disable-warning, sign-compare) >> > KBUILD_CFLAGS += $(call cc-disable-warning, format-zero-length) >> > KBUILD_CFLAGS += $(call cc-disable-warning, uninitialized) >> > +else >> > +# noisy gcc-7 warnings >> > +KBUILD_CFLAGS += $(call cc-option,-Wformat-truncation=0) >> > endif >> > endif >> >> Hi Andrew, Linus, Greg, >> >> I noticed that Linus has made a similar patch in 4.13-rc1, commit bd664f6b3e37 >> ("disable new gcc-7.1.1 warnings for now"), and it completely disables three >> warnings (format-truncation, format-overflow and int-in-bool-context). >> >> Obviously there is no point in having both, so let's talk about what we >> want for 4.13, stable-backports and for future kernels, I'll then send those >> patches. Here is my first suggestion: >> >> - enable all three warnings with "make W=1" in 4.13, but leave them >> disabled by default. >> - backport Linus' patch, plus the follow-up for W=1 to stable kernels, >> to allow stable kernels to build cleanly > > I don't care which of these, I'll take whatever is in Linus's tree. > > And I'll go backport that patch now as I'm getting annoyed by the > warnings at the moment... Yes, that's what I meant here, the follow-up obviously has to be agreed on before that can be backported. Let me know what other warnings you see on the stable kernels after backporting the bd664f6b3e37 patch, I can help identify the fixes that went into mainline to address those if you want. >> - backport the patches that address any other gcc-7 warnings, as >> well as those that are not obvious false-positives to stable kernels > > I'll do that as well, as I notice them go by. > >> - In 4.14+, use my version above and address all int-in-bool-context >> and format-overflow warnings, but only use -Wformat-truncation >> with make W=1. > > I don't really care about this, as long as we are not forced to do > "silly things" like some of the patches seemed to do :) Sure, I understand that from the previous feedback, and for a couple of patches I found better workarounds (that improve the code while fixing the warning, rather than adding hacks). I also reported two of them in gcc bugzilla already, one was decided to be invalid: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81484 the other one looks valid, but possibly hard to fix: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81483 When I go through the remaining patches again, I'll have a look at what others might be incorrect warnings that should be fixed in gcc, or which ones can be fixed in a better way. I just wanted to first make sure that there is no fundamental objections to enabling the warnings in future kernels (at whichever W= level) at all. Arnd ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: + kbuild-disable-wformat-truncation-warnings-by-default.patch added to -mm tree 2017-07-20 7:24 ` + kbuild-disable-wformat-truncation-warnings-by-default.patch added to -mm tree Arnd Bergmann 2017-07-20 8:17 ` gregkh @ 2017-08-20 13:19 ` Masahiro Yamada 2017-08-20 19:51 ` Arnd Bergmann 1 sibling, 1 reply; 6+ messages in thread From: Masahiro Yamada @ 2017-08-20 13:19 UTC (permalink / raw) To: Arnd Bergmann Cc: Andrew Morton, mm-commits, Linus Torvalds, Linux Kernel Mailing List, Linux Kbuild mailing list, stable, gregkh Hi Arnd, 2017-07-20 16:24 GMT+09:00 Arnd Bergmann <arnd@arndb.de>: > On Wed, Jul 19, 2017 at 11:50 PM, <akpm@linux-foundation.org> wrote: >> ------------------------------------------------------ >> From: Arnd Bergmann <arnd@arndb.de> >> Subject: kbuild: disable -Wformat-truncation warnings by default >> >> With x86 allmodconfig, we currently get 233 -Wformat-truncation warnings, >> which makes the entire warnings rather useless. >> >> This turns off the warning by default, unless we specify W=1 or higher >> >> Link: http://lkml.kernel.org/r/20170714120720.906842-2-arnd@arndb.de >> Signed-off-by: Arnd Bergmann <arnd@arndb.de> >> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> >> --- >> >> scripts/Makefile.extrawarn | 3 +++ >> 1 file changed, 3 insertions(+) >> >> diff -puN scripts/Makefile.extrawarn~kbuild-disable-wformat-truncation-warnings-by-default scripts/Makefile.extrawarn >> --- a/scripts/Makefile.extrawarn~kbuild-disable-wformat-truncation-warnings-by-default >> +++ a/scripts/Makefile.extrawarn >> @@ -67,5 +67,8 @@ KBUILD_CFLAGS += $(call cc-disable-warni >> KBUILD_CFLAGS += $(call cc-disable-warning, sign-compare) >> KBUILD_CFLAGS += $(call cc-disable-warning, format-zero-length) >> KBUILD_CFLAGS += $(call cc-disable-warning, uninitialized) >> +else >> +# noisy gcc-7 warnings >> +KBUILD_CFLAGS += $(call cc-option,-Wformat-truncation=0) >> endif >> endif > > Hi Andrew, Linus, Greg, > > I noticed that Linus has made a similar patch in 4.13-rc1, commit bd664f6b3e37 > ("disable new gcc-7.1.1 warnings for now"), and it completely disables three > warnings (format-truncation, format-overflow and int-in-bool-context). > > Obviously there is no point in having both, so let's talk about what we > want for 4.13, stable-backports and for future kernels, I'll then send those > patches. Here is my first suggestion: > > - enable all three warnings with "make W=1" in 4.13, but leave them > disabled by default. > - backport Linus' patch, plus the follow-up for W=1 to stable kernels, > to allow stable kernels to build cleanly > - backport the patches that address any other gcc-7 warnings, as > well as those that are not obvious false-positives to stable kernels > - In 4.14+, use my version above and address all int-in-bool-context > and format-overflow warnings, but only use -Wformat-truncation > with make W=1. > Talking about 4.14+, shall we move -Wformat-truncation from the top Makefile (always disable) to Makefile.extrawarn (enable with W=1) ? -- Best Regards Masahiro Yamada ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: + kbuild-disable-wformat-truncation-warnings-by-default.patch added to -mm tree 2017-08-20 13:19 ` Masahiro Yamada @ 2017-08-20 19:51 ` Arnd Bergmann 2017-08-21 1:45 ` Masahiro Yamada 0 siblings, 1 reply; 6+ messages in thread From: Arnd Bergmann @ 2017-08-20 19:51 UTC (permalink / raw) To: Masahiro Yamada Cc: Andrew Morton, mm-commits, Linus Torvalds, Linux Kernel Mailing List, Linux Kbuild mailing list, stable, gregkh On Sun, Aug 20, 2017 at 3:19 PM, Masahiro Yamada <yamada.masahiro@socionext.com> wrote: > 2017-07-20 16:24 GMT+09:00 Arnd Bergmann <arnd@arndb.de>: >> - enable all three warnings with "make W=1" in 4.13, but leave them >> disabled by default. >> - backport Linus' patch, plus the follow-up for W=1 to stable kernels, >> to allow stable kernels to build cleanly >> - backport the patches that address any other gcc-7 warnings, as >> well as those that are not obvious false-positives to stable kernels >> - In 4.14+, use my version above and address all int-in-bool-context >> and format-overflow warnings, but only use -Wformat-truncation >> with make W=1. >> > > Talking about 4.14+, shall we move -Wformat-truncation > from the top Makefile (always disable) to > Makefile.extrawarn (enable with W=1) ? I dropped the ball on this one, sorry. I think we should do this for all three warnings (format-overflow, format-truncation and int-in-bool-context) for the time being. In case of format-truncation, there are countless warnings, most of them false-postives, so we simply can't enable them by default. For -Wformat-overflow, there is one patch that I need to rewrite, all my other patches are pending for 4.14, see https://patchwork.kernel.org/patch/9840801/ for the missing one. This should be trivial to fix. However, enabling CONFIG_UBSAN_SANITIZE_ALL results in seven additional false positives. I created an patch for this in https://pastebin.com/CD7nhRNp but can't submit that as it's obviously bogus. I reported the gcc bug as https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81592 What we could do there is to disable the warning if CONFIG_UBSAN_SANITIZE_ALL is turned on (like we do for -Wmaybe-uninitialized in CONFIG_UBSAN_SANITIZE_ALL) but leave it on otherwise. I submitted patches for all -Wint-in-bool-context in arm/arm64/x86 randconfig builds, but there are still six known warnings for which my patches did not get queued for 4.14. I have to revisit those all to decide whether we can find an acceptable workaround in the kernel and enable the warning again by default, or leave it in W=1 until gcc improves enough. Arnd ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: + kbuild-disable-wformat-truncation-warnings-by-default.patch added to -mm tree 2017-08-20 19:51 ` Arnd Bergmann @ 2017-08-21 1:45 ` Masahiro Yamada 0 siblings, 0 replies; 6+ messages in thread From: Masahiro Yamada @ 2017-08-21 1:45 UTC (permalink / raw) To: Arnd Bergmann Cc: Andrew Morton, mm-commits, Linus Torvalds, Linux Kernel Mailing List, Linux Kbuild mailing list, stable, gregkh Hi Arnd, 2017-08-21 4:51 GMT+09:00 Arnd Bergmann <arnd@arndb.de>: > On Sun, Aug 20, 2017 at 3:19 PM, Masahiro Yamada > <yamada.masahiro@socionext.com> wrote: >> 2017-07-20 16:24 GMT+09:00 Arnd Bergmann <arnd@arndb.de>: >>> - enable all three warnings with "make W=1" in 4.13, but leave them >>> disabled by default. >>> - backport Linus' patch, plus the follow-up for W=1 to stable kernels, >>> to allow stable kernels to build cleanly >>> - backport the patches that address any other gcc-7 warnings, as >>> well as those that are not obvious false-positives to stable kernels >>> - In 4.14+, use my version above and address all int-in-bool-context >>> and format-overflow warnings, but only use -Wformat-truncation >>> with make W=1. >>> >> >> Talking about 4.14+, shall we move -Wformat-truncation >> from the top Makefile (always disable) to >> Makefile.extrawarn (enable with W=1) ? > > I dropped the ball on this one, sorry. I think we should do this for > all three warnings (format-overflow, format-truncation and > int-in-bool-context) for the time being. > > In case of format-truncation, there are countless warnings, > most of them false-postives, so we simply can't enable them > by default. > > For -Wformat-overflow, there is one patch that I need to > rewrite, all my other patches are pending for 4.14, see > https://patchwork.kernel.org/patch/9840801/ for the missing > one. This should be trivial to fix. However, enabling > CONFIG_UBSAN_SANITIZE_ALL results in seven additional > false positives. I created an patch for this in > https://pastebin.com/CD7nhRNp but can't submit that as it's > obviously bogus. I reported the gcc bug as > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81592 > > What we could do there is to disable the warning if > CONFIG_UBSAN_SANITIZE_ALL is turned on (like > we do for -Wmaybe-uninitialized in > CONFIG_UBSAN_SANITIZE_ALL) but leave it on otherwise. > > I submitted patches for all -Wint-in-bool-context in arm/arm64/x86 > randconfig builds, but there are still six known warnings for which > my patches did not get queued for 4.14. > I have to revisit those all to decide whether we can find an > acceptable workaround in the kernel and enable the warning again > by default, or leave it in W=1 until gcc improves enough. > I was just wondering how to handle your original patch. I do not mean to press you. We can take our time to make the right decision. Thanks! -- Best Regards Masahiro Yamada ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-08-21 1:46 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <596fd414.fDkQ2LPtuAl0Zq0f%akpm@linux-foundation.org>
2017-07-20 7:24 ` + kbuild-disable-wformat-truncation-warnings-by-default.patch added to -mm tree Arnd Bergmann
2017-07-20 8:17 ` gregkh
2017-07-20 10:41 ` Arnd Bergmann
2017-08-20 13:19 ` Masahiro Yamada
2017-08-20 19:51 ` Arnd Bergmann
2017-08-21 1:45 ` Masahiro Yamada
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox