Messages in this thread | | | Date | Wed, 3 Jun 2020 20:33:47 -0700 | From | Nathan Chancellor <> | Subject | Re: [PATCH 00/10] Remove uninitialized_var() macro |
| |
On Wed, Jun 03, 2020 at 04:31:53PM -0700, Kees Cook wrote: > Using uninitialized_var() is dangerous as it papers over real bugs[1] > (or can in the future), and suppresses unrelated compiler warnings > (e.g. "unused variable"). If the compiler thinks it is uninitialized, > either simply initialize the variable or make compiler changes. > > As recommended[2] by[3] Linus[4], remove the macro. > > Most of the 300 uses don't cause any warnings on gcc 9.3.0, so they're in > a single treewide commit in this series. A few others needed to actually > get cleaned up, and I broke those out into individual patches. > > -Kees > > [1] https://lore.kernel.org/lkml/20200603174714.192027-1-glider@google.com/ > [2] https://lore.kernel.org/lkml/CA+55aFw+Vbj0i=1TGqCR5vQkCzWJ0QxK6CernOU6eedsudAixw@mail.gmail.com/ > [3] https://lore.kernel.org/lkml/CA+55aFwgbgqhbp1fkxvRKEpzyR5J8n1vKT1VZdz9knmPuXhOeg@mail.gmail.com/ > [4] https://lore.kernel.org/lkml/CA+55aFz2500WfbKXAx8s67wrm9=yVJu65TpLgN_ybYNv0VEOKA@mail.gmail.com/ > > Kees Cook (10): > x86/mm/numa: Remove uninitialized_var() usage > drbd: Remove uninitialized_var() usage > b43: Remove uninitialized_var() usage > rtlwifi: rtl8192cu: Remove uninitialized_var() usage > ide: Remove uninitialized_var() usage > clk: st: Remove uninitialized_var() usage > spi: davinci: Remove uninitialized_var() usage > checkpatch: Remove awareness of uninitialized_var() macro > treewide: Remove uninitialized_var() usage > compiler: Remove uninitialized_var() macro
I applied all of these on top of cb8e59cc8720 and ran a variety of builds with clang for arm32, arm64, mips, powerpc, s390, and x86_64 [1] and only saw one warning pop up (which was about a variable being unused, commented on patch 9 about it). No warnings about uninitialized variables came up; clang's -Wuninitialized was not impacted by 78a5255ffb6a ("Stop the ad-hoc games with -Wno-maybe-initialized") so it should have caught anything egregious.
[1]: https://github.com/nathanchance/llvm-kernel-testing
For the series, consider it:
Tested-by: Nathan Chancellor <natechancellor@gmail.com> [build]
| |