Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759132AbcJQWUN (ORCPT ); Mon, 17 Oct 2016 18:20:13 -0400 Received: from mout.kundenserver.de ([212.227.17.10]:60894 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758216AbcJQWT5 (ORCPT ); Mon, 17 Oct 2016 18:19:57 -0400 From: Arnd Bergmann To: x86@kernel.org Cc: Linus Torvalds , linux-kernel@vger.kernel.org, Arnd Bergmann , Bill Metzenthen , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" Subject: [PATCH 24/28] x86: math-emu: possible uninitialized variable use Date: Tue, 18 Oct 2016 00:16:12 +0200 Message-Id: <20161017221650.1902729-5-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20161017220342.1627073-1-arnd@arndb.de> References: <20161017220342.1627073-1-arnd@arndb.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K0:RTRYOQPxpo19meI6rR9reeXFlQV6T5Z4mBO+zUb915vDs3FzRX8 LXm7xA0dlBmTCMsN5PrfIFAjtQrzP4hJlEW8H0C8gk6bySwiqRUflqoLq10p7l+YOXnizKb JHZUt0ZUUEhS2f7qrsqOYyDwsS2FP9geeefAx2YPuda5LmvjQwsUzsRO7rEXD9O/gZhcySW 3dc/tRE3ZLsS0EBjcO/Qw== X-UI-Out-Filterresults: notjunk:1;V01:K0:gfPscKvHZH4=:g0WLrdDkVIXGH4nViSjTbs rf+P9qOUEQQFoDIGG4eyMXaTvZtt1Is9CDVAGglwr3q3rKTMfLBQgA1DqKz47+7mkR9YxAjcS IQlqjkfl8aCdrjp0QAjl7HsLoYFxaC4iyyQFVeimamdqpD1ahRSZIO84cql4LB5m4vAjz6xy3 sABMgsaVMUkG9kx3Du2B4IytDeTGM9XXeEVeFdgWtPQLfc2mzmIkJjPdA38xeB7J5LHxm0X+k bS6GLxsyjS6OaNu6bRg6HSkVQfMMJjxHHXwTsZq9TwtkfNjE4sDihSr1lt7OVJuMpXieD0IiR c6Pl5Bybgj4oCcZnT3H8ZJYS5L6e8jj7tm4XfYcPb9yMoW0JShInGaeAZpwbYvx6ik5H3gIHI NDjajSDMgTgIHoOyCcwc1qrmMGOAI7gSIDpMlK0iozzqHFax8cK5uPzn0iwDimqjgvXT8Uyp/ 1LogXVdkUFlnCmTtFhRFV4wxIrw5b+ECnkxys8lUMRGo+yMPtCKufDqkeJw37NudMnEWaFl8Z X426mVLaQ2bnUYRJbyr9xODN9XgtFGc5urV7+cvhsLuRNmU56Z6ccjT8+x4EorqnXeqU6rq3C keqDVW7k23YxXaU9I+/HcM414BeEWLdPgSCEhj3LPRlfEGFAUfAz6q4cujd3rTN0rCe7tQDu4 DFaXCWcot82cRF/kH+xtBUEqgPqS6GlGQtwBHOvZ8OhVgkUKfolpopxmTHIxIw6QMDETvA7ff H7WQnSE//eEZmV9g Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3105 Lines: 103 When building the kernel with "make EXTRA_CFLAGS=...", this overrides the "PARANOID" preprocessor macro defined in arch/x86/math-emu/Makefile, and we run into a build warning: arch/x86/math-emu/reg_compare.c: In function ‘compare_i_st_st’: arch/x86/math-emu/reg_compare.c:254:6: error: ‘f’ may be used uninitialized in this function [-Werror=maybe-uninitialized] This fixes the implementation to work correctly even without the PARANOID flag, and also fixes the Makefile to not use the EXTRA_CFLAGS variable but instead use the ccflags-y variable in the Makefile that is meant for this purpose. Cc: x86@kernel.org Signed-off-by: Arnd Bergmann --- arch/x86/math-emu/Makefile | 4 ++-- arch/x86/math-emu/reg_compare.c | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/arch/x86/math-emu/Makefile b/arch/x86/math-emu/Makefile index 9b0c63b..1b2dac1 100644 --- a/arch/x86/math-emu/Makefile +++ b/arch/x86/math-emu/Makefile @@ -5,8 +5,8 @@ #DEBUG = -DDEBUGGING DEBUG = PARANOID = -DPARANOID -EXTRA_CFLAGS := $(PARANOID) $(DEBUG) -fno-builtin $(MATH_EMULATION) -EXTRA_AFLAGS := $(PARANOID) +ccflags-y += $(PARANOID) $(DEBUG) -fno-builtin $(MATH_EMULATION) +asflags-y += $(PARANOID) # From 'C' language sources: C_OBJS =fpu_entry.o errors.o \ diff --git a/arch/x86/math-emu/reg_compare.c b/arch/x86/math-emu/reg_compare.c index b77360f..19b33b50 100644 --- a/arch/x86/math-emu/reg_compare.c +++ b/arch/x86/math-emu/reg_compare.c @@ -168,7 +168,7 @@ static int compare(FPU_REG const *b, int tagb) /* This function requires that st(0) is not empty */ int FPU_compare_st_data(FPU_REG const *loaded_data, u_char loaded_tag) { - int f = 0, c; + int f, c; c = compare(loaded_data, loaded_tag); @@ -189,12 +189,12 @@ int FPU_compare_st_data(FPU_REG const *loaded_data, u_char loaded_tag) case COMP_No_Comp: f = SW_C3 | SW_C2 | SW_C0; break; -#ifdef PARANOID default: +#ifdef PARANOID EXCEPTION(EX_INTERNAL | 0x121); +#endif /* PARANOID */ f = SW_C3 | SW_C2 | SW_C0; break; -#endif /* PARANOID */ } setcc(f); if (c & COMP_Denormal) { @@ -205,7 +205,7 @@ int FPU_compare_st_data(FPU_REG const *loaded_data, u_char loaded_tag) static int compare_st_st(int nr) { - int f = 0, c; + int f, c; FPU_REG *st_ptr; if (!NOT_EMPTY(0) || !NOT_EMPTY(nr)) { @@ -235,12 +235,12 @@ static int compare_st_st(int nr) case COMP_No_Comp: f = SW_C3 | SW_C2 | SW_C0; break; -#ifdef PARANOID default: +#ifdef PARANOID EXCEPTION(EX_INTERNAL | 0x122); +#endif /* PARANOID */ f = SW_C3 | SW_C2 | SW_C0; break; -#endif /* PARANOID */ } setcc(f); if (c & COMP_Denormal) { @@ -283,12 +283,12 @@ static int compare_i_st_st(int nr) case COMP_No_Comp: f = X86_EFLAGS_ZF | X86_EFLAGS_PF | X86_EFLAGS_CF; break; -#ifdef PARANOID default: +#ifdef PARANOID EXCEPTION(EX_INTERNAL | 0x122); +#endif /* PARANOID */ f = 0; break; -#endif /* PARANOID */ } FPU_EFLAGS = (FPU_EFLAGS & ~(X86_EFLAGS_ZF | X86_EFLAGS_PF | X86_EFLAGS_CF)) | f; if (c & COMP_Denormal) { -- 2.9.0