From patchwork Wed Jul 19 12:53:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 108280 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp779984qge; Wed, 19 Jul 2017 05:55:21 -0700 (PDT) X-Received: by 10.99.113.77 with SMTP id b13mr2829234pgn.11.1500468921265; Wed, 19 Jul 2017 05:55:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1500468921; cv=none; d=google.com; s=arc-20160816; b=KGxYWMg6w00YZVJjzZImNIZqDgshNZ74ZVZhaORY0M4Sezu6h9gk9FI9OKY00dJr0z a5zcbIcQT2gltGR58jU868qKOr7yOgaMmp29hltfHNSpfrCiZppMqQkbobwVY/iky72n U9u+Qf5txHLESRHOjTGROyepUs7UBUpvHuPMb9yqfzpCDzFkC5H+SOzJ0HDwvCKJht/T 8jr8tWBEegiuRL47NTKdEvDNCm/xn0fDncTbV4ojd9/TH1enuDLZrWK1blY6GBqQJPJI M+5KnyTUrz2N8nzTVMWIrx9d+Dd/NviO+wDdlLUeEkU43eYDYsTCqUj3R97Qi3ctM8wr wg/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=InRXL1weIfampBktlI5tZ9eymOvN8Ycxkp/ZoTQ13U0=; b=XPq4+wOo81HISTL1sROr4kQgkNjU+VzWll8u74WCi49YskwXFbYB0qRE6MXKpcY3aF +047c1guVmGH7M+N58Vt+J7J0GI70qAW5U7ikaRAPBfHYyxslGvKk+ix31UkI1SZXMs+ Jq3ykXe7pbKYiqxVQ2br6AsgdIv0+wHdFo76YLkWP2ZMJdAMWbwdgK/R6P70ed39Ty3M XI7mjM8gWUQCG5i6EL55f/KvK7/QwAa0vUNIDH/qPkhqAHoVrnCyPqa5X8bcLCOFBQei 39K70uXs6gKOqFQHSq/H6U9+KB30GgfykvczAikZ/ShbHizr0/BEolioGgXamERi7OQM Splg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b6si198385pfg.676.2017.07.19.05.55.20; Wed, 19 Jul 2017 05:55:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753513AbdGSMzR (ORCPT + 25 others); Wed, 19 Jul 2017 08:55:17 -0400 Received: from mout.kundenserver.de ([212.227.17.10]:54552 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752794AbdGSMzP (ORCPT ); Wed, 19 Jul 2017 08:55:15 -0400 Received: from wuerfel.lan ([5.56.224.194]) by mrelayeu.kundenserver.de (mreue102 [212.227.15.145]) with ESMTPA (Nemesis) id 0LsQ6y-1deWbI21Si-0122u4; Wed, 19 Jul 2017 14:54:08 +0200 From: Arnd Bergmann To: x86@kernel.org, Bill Metzenthen , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" Cc: linux-kernel@vger.kernel.org, Arnd Bergmann Subject: [PATCH 2/8] x86: math-emu: possible uninitialized variable use Date: Wed, 19 Jul 2017 14:53:00 +0200 Message-Id: <20170719125310.2487451-3-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20170719125310.2487451-1-arnd@arndb.de> References: <20170719125310.2487451-1-arnd@ar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MQbrFtaEmTmgf2lNPoLgyOwHUowItySL18= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Signed-off-by: Arnd Bergmann --- Originally sent on Oct. 17 2016, resending unmodified --- arch/x86/math-emu/Makefile | 4 ++-- arch/x86/math-emu/reg_compare.c | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) -- 2.9.0 diff --git a/arch/x86/math-emu/Makefile b/arch/x86/math-emu/Makefile index 9b0c63b60302..1b2dac174321 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 b77360fdbf4a..19b33b50adfa 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) {