29b00e609960ae0fcff382f4c7079dd0874a5311 would have been caught with Clang in its default configuration (and not by GCC due to a bug), as pointed out in this thread: https://lore.kernel.org/lkml/[email protected]/
However, -Wuninitialized also disables -Wsometimes-uninitialized so this was missed by both compilers :(
I am going to test the following diff then send it along right away if there are no additional warnings:
diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
index 768306add591..f4332981ea85 100644
--- a/scripts/Makefile.extrawarn
+++ b/scripts/Makefile.extrawarn
@@ -72,5 +72,6 @@ KBUILD_CFLAGS += $(call cc-disable-warning, format)
KBUILD_CFLAGS += $(call cc-disable-warning, sign-compare)
KBUILD_CFLAGS += $(call cc-disable-warning, format-zero-length)
KBUILD_CFLAGS += $(call cc-disable-warning, uninitialized)
+KBUILD_CFLAGS += $(call cc-option, -Wsometimes-uninitialized)
endif
endif
Side note, looks like this might be a good time to tell Linus about the KernelCI work that is going on: https://lore.kernel.org/lkml/CAHk-=wggjLsi-1BmDHqWAJPzBvTD_-MQNo5qQ9WCuncnyWPROg@mail.gmail.com/
heh, wish I was cc'ed on that thread (I'm not subbed to lkml, ducks)
I'm not subbed to lkml, _ducks_
Neither am I, I happened to stumble across it while browsing https://lore.kernel.org/lkml/. Guess I should be after this.
It is still possible to reply without being CC'd (if you use mutt). Otherwise, the link gives reply instructions using git send-email at the bottom.
$ curl -LSs -o mbox https://lore.kernel.org/lkml/CAHk-=wggjLsi-1BmDHqWAJPzBvTD_-MQNo5qQ9WCuncnyWPROg@mail.gmail.com/raw
$ mutt -f mbox
Unfortunately, introduces a few warnings: https://gist.github.com/nathanchance/59f35754366c7d68141a5f44fe9302b8
Another project like #378 (seems like it could be achieved quicker).
Yes; and many of those have the same source file (and even the same warning in some cases; like maybe a shared problematic macro). Thanks for the link; I'll file bugs for all of those, and we'll use this to track enabling the warning.
12 altogether (including this one)
Filed some more issues last night that appeared after I quickly hacked up a monolithic patch to address the ones above. I should have just built without -Werror the first time, sigh.
Still, only 22 instances it looks like, I'll start working on them in a bit.
specifically scripts/Makefile.extrawarn has this block:
ifdef CONFIG_CC_IS_CLANG
KBUILD_CFLAGS += $(call cc-disable-warning, initializer-overrides)
KBUILD_CFLAGS += $(call cc-disable-warning, unused-value)
KBUILD_CFLAGS += $(call cc-disable-warning, format)
KBUILD_CFLAGS += $(call cc-disable-warning, sign-compare)
KBUILD_CFLAGS += $(call cc-disable-warning, format-zero-length)
KBUILD_CFLAGS += $(call cc-disable-warning, uninitialized)
endif
Patch sent: https://lore.kernel.org/lkml/[email protected]/
Alright, we are down to three open warnings: #465, #492, and #499.
It might be worth pulling the trigger and enabling the warnings before these issues are fixed in -next so things like KernelCI and 0day can catch them quicker.
@nathanchance I think it's time to send the patch enabling this. WDYT?
I am fine with enabling this now though so we get more coverage on CI.
Patch sent: https://lore.kernel.org/lkml/[email protected]/
Merged into mainline: https://git.kernel.org/torvalds/c/3a61925e91ba9f0ece1b444eb1aa49caa59e4ae7
Most helpful comment
Merged into mainline: https://git.kernel.org/torvalds/c/3a61925e91ba9f0ece1b444eb1aa49caa59e4ae7