This is a note to let you know that I've just added the patch titled x86/fpu/math-emu: Fix possible uninitialized variable use to the 4.9-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: x86-fpu-math-emu-fix-possible-uninitialized-variable-use.patch and it can be found in the queue-4.9 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 75e2f0a6b16141cb347f442033ec907380d4d66e Mon Sep 17 00:00:00 2001 From: Arnd Bergmann <arnd@xxxxxxxx> Date: Wed, 19 Jul 2017 14:53:00 +0200 Subject: x86/fpu/math-emu: Fix possible uninitialized variable use MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Arnd Bergmann <arnd@xxxxxxxx> commit 75e2f0a6b16141cb347f442033ec907380d4d66e upstream. 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 <arnd@xxxxxxxx> Cc: Bill Metzenthen <billm@xxxxxxxxxxxxx> Cc: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx> Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx> Link: http://lkml.kernel.org/r/20170719125310.2487451-3-arnd@xxxxxxxx Signed-off-by: Ingo Molnar <mingo@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- arch/x86/math-emu/Makefile | 4 ++-- arch/x86/math-emu/reg_compare.c | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) --- 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 \ --- 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 /* 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 *l 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 *l 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) { Patches currently in stable-queue which might be from arnd@xxxxxxxx are queue-4.9/kasan-rework-kconfig-settings.patch queue-4.9/tw5864-use-dev_warn-instead-of-warn-to-shut-up-warning.patch queue-4.9/perf-x86-shut-up-false-positive-wmaybe-uninitialized-warning.patch queue-4.9/go7007-add-media_camera_support-dependency.patch queue-4.9/scsi-advansys-fix-build-warning-for-pci-n.patch queue-4.9/video-fbdev-via-remove-possibly-unused-variables.patch queue-4.9/drm-exynos-mark-pm-functions-as-__maybe_unused.patch queue-4.9/binfmt_elf-compat-avoid-unused-function-warning.patch queue-4.9/idle-i7300-add-pci-dependency.patch queue-4.9/cw1200-fix-bogus-maybe-uninitialized-warning.patch queue-4.9/x86-build-silence-the-build-with-make-s.patch queue-4.9/gpio-xgene-mark-pm-functions-as-__maybe_unused.patch queue-4.9/kvm-add-x86_local_apic-dependency.patch queue-4.9/reiserfs-avoid-a-wmaybe-uninitialized-warning.patch queue-4.9/scsi-advansys-fix-uninitialized-data-access.patch queue-4.9/drm-i915-fix-intel_backlight_device_register-declaration.patch queue-4.9/spi-bcm-qspi-shut-up-warning-about-cfi-header-inclusion.patch queue-4.9/asoc-ux500-add-module_license-tag.patch queue-4.9/x86-microcode-amd-change-load_microcode_amd-s-param-to-bool-to-fix-preemptibility-bug.patch queue-4.9/video-fbdev-mmp-add-module_license.patch queue-4.9/usb-phy-msm-add-regulator-dependency.patch queue-4.9/arm64-dts-add-cooling-cells-to-cpu-nodes.patch queue-4.9/vmxnet3-prevent-building-with-64k-pages.patch queue-4.9/x86-platform-add-pci-dependency-for-punit_atom_debug.patch queue-4.9/alsa-hda-ca0132-fix-possible-null-pointer-use.patch queue-4.9/thermal-fix-intel_soc_dts_iosf_core-dependencies.patch queue-4.9/arm64-define-bug-instruction-without-config_bug.patch queue-4.9/arm64-sunxi-always-enable-reset-controller.patch queue-4.9/tc358743-fix-register-i2c_rd-wr-functions.patch queue-4.9/security-keys-big_key-requires-config_crypto.patch queue-4.9/drm-i915-hide-unused-intel_panel_set_backlight-function.patch queue-4.9/x86-fpu-math-emu-fix-possible-uninitialized-variable-use.patch queue-4.9/arm-8743-1-bl_switcher-add-module_license-tag.patch queue-4.9/em28xx-only-use-mt9v011-if-camera-support-is-enabled.patch queue-4.9/arm64-fix-warning-about-swapper_pg_dir-overflow.patch queue-4.9/shmem-avoid-maybe-uninitialized-warning.patch queue-4.9/input-tca8418_keypad-hide-gcc-4.9-wmaybe-uninitialized-warning.patch queue-4.9/drm-nouveau-hide-gcc-4.9-wmaybe-uninitialized.patch queue-4.9/x86-add-multiuser-dependency-for-kvm.patch queue-4.9/isdn-eicon-reduce-stack-size-of-sig_ind-function.patch