From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933291AbcAYQBI (ORCPT ); Mon, 25 Jan 2016 11:01:08 -0500 Received: from mx2.parallels.com ([199.115.105.18]:41824 "EHLO mx2.parallels.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932914AbcAYQAm (ORCPT ); Mon, 25 Jan 2016 11:00:42 -0500 From: Andrey Ryabinin To: Andrew Morton CC: , , , Andrey Ryabinin Subject: [PATCH] ubsan: fix tree-wide -Wmaybe-uninitialized false positives Date: Mon, 25 Jan 2016 19:01:34 +0300 Message-ID: <1453737694-19138-1-git-send-email-aryabinin@virtuozzo.com> X-Mailer: git-send-email 2.4.10 In-Reply-To: <201601251528.rosikkYN%fengguang.wu@intel.com> References: <201601251528.rosikkYN%fengguang.wu@intel.com> MIME-Version: 1.0 Content-Type: text/plain X-ClientProxiedBy: US-EXCH.sw.swsoft.com (10.255.249.47) To US-EXCH.sw.swsoft.com (10.255.249.47) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org -fsanitize=* options makes GCC less smart than usual and increase number of 'maybe-uninitialized' false-positives. So this patch does two things: * Add -Wno-maybe-uninitialized to CFLAGS_UBSAN which will disable all such warnings for instrumented files. * Remove CONFIG_UBSAN_SANITIZE_ALL from all[yes|mod]config builds. So the all[yes|mod]config build goes without -fsanitize=* and still with -Wmaybe-uninitialized. Signed-off-by: Andrey Ryabinin Reported-by: Fengguang Wu --- lib/Kconfig.ubsan | 5 +++++ scripts/Makefile.ubsan | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/lib/Kconfig.ubsan b/lib/Kconfig.ubsan index 49518fb..82da62bb 100644 --- a/lib/Kconfig.ubsan +++ b/lib/Kconfig.ubsan @@ -13,6 +13,11 @@ config UBSAN_SANITIZE_ALL bool "Enable instrumentation for the entire kernel" depends on UBSAN depends on ARCH_HAS_UBSAN_SANITIZE_ALL + + # We build with -Wno-maybe-uninitilzed, but we still want to + # use -Wmaybe-uninitilized in allmodconfig builds. + # So dependsy bellow used to disable this option in allmodconfig + depends on !COMPILE_TEST default y help This option activates instrumentation for the entire kernel. diff --git a/scripts/Makefile.ubsan b/scripts/Makefile.ubsan index 8ab6867..77ce538 100644 --- a/scripts/Makefile.ubsan +++ b/scripts/Makefile.ubsan @@ -14,4 +14,8 @@ ifdef CONFIG_UBSAN ifdef CONFIG_UBSAN_ALIGNMENT CFLAGS_UBSAN += $(call cc-option, -fsanitize=alignment) endif + + # -fsanitize=* options makes GCC less smart than usual and + # increase number of 'maybe-uninitialized false-positives + CFLAGS_UBSAN += $(call cc-option, -Wno-maybe-uninitialized) endif -- 2.4.10