Re: [PATCH 00/10] Remove uninitialized_var() macro

From: Nathan Chancellor
Date: Wed Jun 03 2020 - 23:33:53 EST

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]
> [2]
> [3]
> [4]
> 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.


For the series, consider it:

Tested-by: Nathan Chancellor <natechancellor@xxxxxxxxx> [build]