--- /dev/null
+From 46a049dae771b95e77ac6c823330f4a60f600236 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Wed, 11 Jan 2017 14:39:44 +0100
+Subject: ALSA: hda/ca0132 - fix possible NULL pointer use
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit 46a049dae771b95e77ac6c823330f4a60f600236 upstream.
+
+gcc-7 caught what it considers a NULL pointer dereference:
+
+sound/pci/hda/patch_ca0132.c: In function 'dspio_scp.constprop':
+sound/pci/hda/patch_ca0132.c:1487:4: error: argument 1 null where non-null expected [-Werror=nonnull]
+
+This is plausible from looking at the function, as we compare 'reply'
+to NULL earlier in it. I have not tried to analyze if there are constraints
+that make it impossible to hit the bug, but adding another NULL check in
+the end kills the warning and makes the function more robust.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/pci/hda/patch_ca0132.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+--- a/sound/pci/hda/patch_ca0132.c
++++ b/sound/pci/hda/patch_ca0132.c
+@@ -1482,6 +1482,9 @@ static int dspio_scp(struct hda_codec *c
+ } else if (ret_size != reply_data_size) {
+ codec_dbg(codec, "RetLen and HdrLen .NE.\n");
+ return -EINVAL;
++ } else if (!reply) {
++ codec_dbg(codec, "NULL reply\n");
++ return -EINVAL;
+ } else {
+ *reply_len = ret_size*sizeof(unsigned int);
+ memcpy(reply, scp_reply.data, *reply_len);
--- /dev/null
+From 91eefaabf102c539e6f5531e9a1e5ed46d2b41ca Mon Sep 17 00:00:00 2001
+From: Borislav Petkov <bp@suse.de>
+Date: Sat, 26 Nov 2016 21:53:52 +0100
+Subject: amd-xgbe: Fix unused suspend handlers build warning
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Borislav Petkov <bp@suse.de>
+
+commit 91eefaabf102c539e6f5531e9a1e5ed46d2b41ca upstream.
+
+Fix:
+
+ drivers/net/ethernet/amd/xgbe/xgbe-main.c:835:12: warning: ‘xgbe_suspend’ defined
+ but not used [-Wunused-function]
+ drivers/net/ethernet/amd/xgbe/xgbe-main.c:855:12: warning: ‘xgbe_resume’ defined
+ but not used [-Wunused-function]
+
+I see it during randconfig builds here.
+
+Signed-off-by: Borislav Petkov <bp@suse.de>
+Cc: Tom Lendacky <thomas.lendacky@amd.com>
+Cc: netdev@vger.kernel.org
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/net/ethernet/amd/xgbe/xgbe-main.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/drivers/net/ethernet/amd/xgbe/xgbe-main.c
++++ b/drivers/net/ethernet/amd/xgbe/xgbe-main.c
+@@ -829,7 +829,7 @@ static int xgbe_remove(struct platform_d
+ return 0;
+ }
+
+-#ifdef CONFIG_PM
++#ifdef CONFIG_PM_SLEEP
+ static int xgbe_suspend(struct device *dev)
+ {
+ struct net_device *netdev = dev_get_drvdata(dev);
+@@ -868,7 +868,7 @@ static int xgbe_resume(struct device *de
+
+ return ret;
+ }
+-#endif /* CONFIG_PM */
++#endif /* CONFIG_PM_SLEEP */
+
+ #ifdef CONFIG_ACPI
+ static const struct acpi_device_id xgbe_acpi_match[] = {
--- /dev/null
+From foo@baz Fri Feb 23 17:12:49 CET 2018
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Tue, 20 Feb 2018 12:54:56 +0100
+Subject: ARM: tegra: select USB_ULPI from EHCI rather than platform
+To: stable@vger.kernel.org
+Cc: Greg KH <gregkh@linuxfoundation.org>, linux-kernel@vger.kernel.org, Arnd Bergmann <arnd@arndb.de>, Thierry Reding <treding@nvidia.com>, Stephen Warren <swarren@wwwdotorg.org>, Thierry Reding <thierry.reding@gmail.com>, Alexandre Courbot <gnurou@gmail.com>, Catalin Marinas <catalin.marinas@arm.com>, Will Deacon <will.deacon@arm.com>, linux-arm-kernel@lists.infradead.org, linux-tegra@vger.kernel.org, linux-usb@vger.kernel.org
+Message-ID: <20180220115527.1806578-10-arnd@arndb.de>
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit a262e87ff354f12447bb6268bd63edf7ba1c20e0 upstream.
+
+For historic reasons, the tegra platform selects USB_ULPI from architecture
+code, but that hasn't really made sense for a long time, as the only
+user of that code is the Tegra EHCI driver that has its own Kconfig
+symbol.
+
+This removes the 'select' statements from mach-tegra and drivers/soc/tegra
+and adds them with the device driver that actually needs them.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Thierry Reding <treding@nvidia.com>
+[arnd: rebased to 4.4-stable]
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/arm/mach-tegra/Kconfig | 2 --
+ arch/arm64/Kconfig.platforms | 2 --
+ drivers/usb/host/Kconfig | 2 ++
+ 3 files changed, 2 insertions(+), 4 deletions(-)
+
+--- a/arch/arm/mach-tegra/Kconfig
++++ b/arch/arm/mach-tegra/Kconfig
+@@ -12,8 +12,6 @@ menuconfig ARCH_TEGRA
+ select ARCH_HAS_RESET_CONTROLLER
+ select RESET_CONTROLLER
+ select SOC_BUS
+- select USB_ULPI if USB_PHY
+- select USB_ULPI_VIEWPORT if USB_PHY
+ help
+ This enables support for NVIDIA Tegra based systems.
+
+--- a/arch/arm64/Kconfig.platforms
++++ b/arch/arm64/Kconfig.platforms
+@@ -90,8 +90,6 @@ config ARCH_TEGRA_132_SOC
+ bool "NVIDIA Tegra132 SoC"
+ depends on ARCH_TEGRA
+ select PINCTRL_TEGRA124
+- select USB_ULPI if USB_PHY
+- select USB_ULPI_VIEWPORT if USB_PHY
+ help
+ Enable support for NVIDIA Tegra132 SoC, based on the Denver
+ ARMv8 CPU. The Tegra132 SoC is similar to the Tegra124 SoC,
+--- a/drivers/usb/host/Kconfig
++++ b/drivers/usb/host/Kconfig
+@@ -220,6 +220,8 @@ config USB_EHCI_TEGRA
+ depends on ARCH_TEGRA
+ select USB_EHCI_ROOT_HUB_TT
+ select USB_PHY
++ select USB_ULPI
++ select USB_ULPI_VIEWPORT
+ help
+ This driver enables support for the internal USB Host Controllers
+ found in NVIDIA Tegra SoCs. The controllers are EHCI compliant.
--- /dev/null
+From f13d52cb3fad03c237572be2ee691e1fe2d1d7bb Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Tue, 14 Mar 2017 22:39:21 +0100
+Subject: arm64: define BUG() instruction without CONFIG_BUG
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit f13d52cb3fad03c237572be2ee691e1fe2d1d7bb upstream.
+
+This mirrors commit e9c38ceba8d9 ("ARM: 8455/1: define __BUG as
+asm(BUG_INSTR) without CONFIG_BUG") to make the behavior of
+arm64 consistent with arm and x86, and avoids lots of warnings in
+randconfig builds, such as:
+
+kernel/seccomp.c: In function '__seccomp_filter':
+kernel/seccomp.c:666:1: error: no return statement in function returning non-void [-Werror=return-type]
+
+Acked-by: Will Deacon <will.deacon@arm.com>
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/arm64/include/asm/bug.h | 35 ++++++++++++++++++++---------------
+ 1 file changed, 20 insertions(+), 15 deletions(-)
+
+--- a/arch/arm64/include/asm/bug.h
++++ b/arch/arm64/include/asm/bug.h
+@@ -20,9 +20,6 @@
+
+ #include <asm/debug-monitors.h>
+
+-#ifdef CONFIG_GENERIC_BUG
+-#define HAVE_ARCH_BUG
+-
+ #ifdef CONFIG_DEBUG_BUGVERBOSE
+ #define _BUGVERBOSE_LOCATION(file, line) __BUGVERBOSE_LOCATION(file, line)
+ #define __BUGVERBOSE_LOCATION(file, line) \
+@@ -36,28 +33,36 @@
+ #define _BUGVERBOSE_LOCATION(file, line)
+ #endif
+
+-#define _BUG_FLAGS(flags) __BUG_FLAGS(flags)
++#ifdef CONFIG_GENERIC_BUG
+
+-#define __BUG_FLAGS(flags) asm volatile ( \
++#define __BUG_ENTRY(flags) \
+ ".pushsection __bug_table,\"a\"\n\t" \
+ ".align 2\n\t" \
+ "0: .long 1f - 0b\n\t" \
+ _BUGVERBOSE_LOCATION(__FILE__, __LINE__) \
+ ".short " #flags "\n\t" \
+ ".popsection\n" \
+- \
+- "1: brk %[imm]" \
+- :: [imm] "i" (BUG_BRK_IMM) \
+-)
+-
+-#define BUG() do { \
+- _BUG_FLAGS(0); \
+- unreachable(); \
++ "1: "
++#else
++#define __BUG_ENTRY(flags) ""
++#endif
++
++#define __BUG_FLAGS(flags) \
++ asm volatile ( \
++ __BUG_ENTRY(flags) \
++ "brk %[imm]" :: [imm] "i" (BUG_BRK_IMM) \
++ );
++
++
++#define BUG() do { \
++ __BUG_FLAGS(0); \
++ unreachable(); \
+ } while (0)
+
+-#define __WARN_TAINT(taint) _BUG_FLAGS(BUGFLAG_TAINT(taint))
++#define __WARN_TAINT(taint) \
++ __BUG_FLAGS(BUGFLAG_TAINT(taint))
+
+-#endif /* ! CONFIG_GENERIC_BUG */
++#define HAVE_ARCH_BUG
+
+ #include <asm-generic/bug.h>
+
--- /dev/null
+From 2e449048a25eb75d48dff12882b93f26d130a1c6 Mon Sep 17 00:00:00 2001
+From: Kefeng Wang <wangkefeng.wang@huawei.com>
+Date: Thu, 26 Jan 2017 11:19:55 +0800
+Subject: arm64: Kconfig: select COMPAT_BINFMT_ELF only when BINFMT_ELF is set
+
+From: Kefeng Wang <wangkefeng.wang@huawei.com>
+
+commit 2e449048a25eb75d48dff12882b93f26d130a1c6 upstream.
+
+Fix warning:
+"(COMPAT) selects COMPAT_BINFMT_ELF which has unmet direct dependencies
+(COMPAT && BINFMT_ELF)"
+
+Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
+Signed-off-by: Will Deacon <will.deacon@arm.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/arm64/Kconfig | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/arch/arm64/Kconfig
++++ b/arch/arm64/Kconfig
+@@ -785,7 +785,7 @@ source "fs/Kconfig.binfmt"
+ config COMPAT
+ bool "Kernel support for 32-bit EL0"
+ depends on ARM64_4K_PAGES || EXPERT
+- select COMPAT_BINFMT_ELF
++ select COMPAT_BINFMT_ELF if BINFMT_ELF
+ select HAVE_UID16
+ select OLD_SIGSUSPEND3
+ select COMPAT_OLD_SIGACTION
--- /dev/null
+From foo@baz Fri Feb 23 17:23:58 CET 2018
+From: Jack Wang <jinpu.wang@profitbricks.com>
+Date: Fri, 23 Feb 2018 11:42:00 +0100
+Subject: array_index_nospec: Sanitize speculative array de-references
+To: gregkh@linuxfoundation.org, stable@vger.kernel.org
+Cc: Dan Williams <dan.j.williams@intel.com>, Thomas Gleixner <tglx@linutronix.de>, linux-arch@vger.kernel.org, kernel-hardening@lists.openwall.com, Peter Zijlstra <peterz@infradead.org>, Catalin Marinas <catalin.marinas@arm.com>, Will Deacon <will.deacon@arm.com>, Russell King <linux@armlinux.org.uk>, torvalds@linux-foundation.org, alan@linux.intel.com, David Woodhouse <dwmw@amazon.co.uk>, Jack Wang <jinpu.wang@profitbricks.com>
+Message-ID: <1519382538-15143-12-git-send-email-jinpu.wangl@profitbricks.com>
+
+From: Dan Williams <dan.j.williams@intel.com>
+
+(cherry picked from commit f3804203306e098dae9ca51540fcd5eb700d7f40)
+
+array_index_nospec() is proposed as a generic mechanism to mitigate
+against Spectre-variant-1 attacks, i.e. an attack that bypasses boundary
+checks via speculative execution. The array_index_nospec()
+implementation is expected to be safe for current generation CPUs across
+multiple architectures (ARM, x86).
+
+Based on an original implementation by Linus Torvalds, tweaked to remove
+speculative flows by Alexei Starovoitov, and tweaked again by Linus to
+introduce an x86 assembly implementation for the mask generation.
+
+Co-developed-by: Linus Torvalds <torvalds@linux-foundation.org>
+Co-developed-by: Alexei Starovoitov <ast@kernel.org>
+Suggested-by: Cyril Novikov <cnovikov@lynx.com>
+Signed-off-by: Dan Williams <dan.j.williams@intel.com>
+Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
+Cc: linux-arch@vger.kernel.org
+Cc: kernel-hardening@lists.openwall.com
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Catalin Marinas <catalin.marinas@arm.com>
+Cc: Will Deacon <will.deacon@arm.com>
+Cc: Russell King <linux@armlinux.org.uk>
+Cc: gregkh@linuxfoundation.org
+Cc: torvalds@linux-foundation.org
+Cc: alan@linux.intel.com
+Link: https://lkml.kernel.org/r/151727414229.33451.18411580953862676575.stgit@dwillia2-desk3.amr.corp.intel.com
+Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
+[jwang: cherry pick to 4.4]
+Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ include/linux/nospec.h | 72 +++++++++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 72 insertions(+)
+ create mode 100644 include/linux/nospec.h
+
+--- /dev/null
++++ b/include/linux/nospec.h
+@@ -0,0 +1,72 @@
++// SPDX-License-Identifier: GPL-2.0
++// Copyright(c) 2018 Linus Torvalds. All rights reserved.
++// Copyright(c) 2018 Alexei Starovoitov. All rights reserved.
++// Copyright(c) 2018 Intel Corporation. All rights reserved.
++
++#ifndef _LINUX_NOSPEC_H
++#define _LINUX_NOSPEC_H
++
++/**
++ * array_index_mask_nospec() - generate a ~0 mask when index < size, 0 otherwise
++ * @index: array element index
++ * @size: number of elements in array
++ *
++ * When @index is out of bounds (@index >= @size), the sign bit will be
++ * set. Extend the sign bit to all bits and invert, giving a result of
++ * zero for an out of bounds index, or ~0 if within bounds [0, @size).
++ */
++#ifndef array_index_mask_nospec
++static inline unsigned long array_index_mask_nospec(unsigned long index,
++ unsigned long size)
++{
++ /*
++ * Warn developers about inappropriate array_index_nospec() usage.
++ *
++ * Even if the CPU speculates past the WARN_ONCE branch, the
++ * sign bit of @index is taken into account when generating the
++ * mask.
++ *
++ * This warning is compiled out when the compiler can infer that
++ * @index and @size are less than LONG_MAX.
++ */
++ if (WARN_ONCE(index > LONG_MAX || size > LONG_MAX,
++ "array_index_nospec() limited to range of [0, LONG_MAX]\n"))
++ return 0;
++
++ /*
++ * Always calculate and emit the mask even if the compiler
++ * thinks the mask is not needed. The compiler does not take
++ * into account the value of @index under speculation.
++ */
++ OPTIMIZER_HIDE_VAR(index);
++ return ~(long)(index | (size - 1UL - index)) >> (BITS_PER_LONG - 1);
++}
++#endif
++
++/*
++ * array_index_nospec - sanitize an array index after a bounds check
++ *
++ * For a code sequence like:
++ *
++ * if (index < size) {
++ * index = array_index_nospec(index, size);
++ * val = array[index];
++ * }
++ *
++ * ...if the CPU speculates past the bounds check then
++ * array_index_nospec() will clamp the index within the range of [0,
++ * size).
++ */
++#define array_index_nospec(index, size) \
++({ \
++ typeof(index) _i = (index); \
++ typeof(size) _s = (size); \
++ unsigned long _mask = array_index_mask_nospec(_i, _s); \
++ \
++ BUILD_BUG_ON(sizeof(_i) > sizeof(long)); \
++ BUILD_BUG_ON(sizeof(_s) > sizeof(long)); \
++ \
++ _i &= _mask; \
++ _i; \
++})
++#endif /* _LINUX_NOSPEC_H */
--- /dev/null
+From foo@baz Fri Feb 23 17:12:49 CET 2018
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Tue, 20 Feb 2018 12:54:57 +0100
+Subject: ASoC: Intel: Kconfig: fix build when ACPI is not enabled
+To: stable@vger.kernel.org
+Cc: Greg KH <gregkh@linuxfoundation.org>, linux-kernel@vger.kernel.org, Vinod Koul <vinod.koul@intel.com>, Mark Brown <broonie@kernel.org>, Arnd Bergmann <arnd@arndb.de>, Liam Girdwood <lgirdwood@gmail.com>, Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>, alsa-devel@alsa-project.org
+Message-ID: <20180220115527.1806578-11-arnd@arndb.de>
+
+From: Vinod Koul <vinod.koul@intel.com>
+
+commit 3493d4a86457c7de9f1e602b4267c9b0f9ec1c9f upstream.
+
+Randy reported following error when ACPI is not enabled:
+
+warning: (SND_SOC_INTEL_BYTCR_RT5640_MACH && SND_SOC_INTEL_BYTCR_RT5651_MACH
+&& SND_SOC_INTEL_CHT_BSW_RT5672_MACH && SND_SOC_INTEL_CHT_BSW_RT5645_MACH &&
+SND_SOC_INTEL_CHT_BSW_MAX98090_TI_MACH) selects SND_SST_IPC_ACPI
++which has unmet direct dependencies (SOUND && !M68K && !UML && SND &&
+SND_SOC && ACPI)
+
+causing these build errors:
+
+In file included from ../sound/soc/intel/atom/sst/sst_acpi.c:40:0:
+../include/acpi/acpi_bus.h:65:20: error: conflicting types for
+'acpi_evaluate_dsm'
+ union acpi_object *acpi_evaluate_dsm(acpi_handle handle, const u8 *uuid,
+In file included from ../sound/soc/intel/atom/sst/sst_acpi.c:31:0:
+../include/linux/acpi.h:676:34: note: previous definition of
+'acpi_evaluate_dsm' was here
+ static inline union acpi_object *acpi_evaluate_dsm(acpi_handle handle,
+
+CONFIG_SND_SST_IPC_ACPI was already dependent upon ACPI, but that was not
+solving it. So move the depends up to machine drivers and remove from
+CONFIG_SND_SST_IPC_ACPI.
+
+Reported-by: Randy Dunlap <rdunlap@infradead.org>
+Signed-off-by: Vinod Koul <vinod.koul@intel.com>
+Signed-off-by: Mark Brown <broonie@kernel.org>
+[arnd: rebased to PATCH kernel]
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ sound/soc/intel/Kconfig | 7 +++----
+ 1 file changed, 3 insertions(+), 4 deletions(-)
+
+--- a/sound/soc/intel/Kconfig
++++ b/sound/soc/intel/Kconfig
+@@ -24,7 +24,6 @@ config SND_SST_IPC_PCI
+ config SND_SST_IPC_ACPI
+ tristate
+ select SND_SST_IPC
+- depends on ACPI
+
+ config SND_SOC_INTEL_SST
+ tristate
+@@ -91,7 +90,7 @@ config SND_SOC_INTEL_BROADWELL_MACH
+
+ config SND_SOC_INTEL_BYTCR_RT5640_MACH
+ tristate "ASoC Audio DSP Support for MID BYT Platform"
+- depends on X86 && I2C
++ depends on X86 && I2C && ACPI
+ select SND_SOC_RT5640
+ select SND_SST_MFLD_PLATFORM
+ select SND_SST_IPC_ACPI
+@@ -103,7 +102,7 @@ config SND_SOC_INTEL_BYTCR_RT5640_MACH
+
+ config SND_SOC_INTEL_CHT_BSW_RT5672_MACH
+ tristate "ASoC Audio driver for Intel Cherrytrail & Braswell with RT5672 codec"
+- depends on X86_INTEL_LPSS && I2C
++ depends on X86_INTEL_LPSS && I2C && ACPI
+ select SND_SOC_RT5670
+ select SND_SST_MFLD_PLATFORM
+ select SND_SST_IPC_ACPI
+@@ -115,7 +114,7 @@ config SND_SOC_INTEL_CHT_BSW_RT5672_MACH
+
+ config SND_SOC_INTEL_CHT_BSW_RT5645_MACH
+ tristate "ASoC Audio driver for Intel Cherrytrail & Braswell with RT5645/5650 codec"
+- depends on X86_INTEL_LPSS && I2C
++ depends on X86_INTEL_LPSS && I2C && ACPI
+ select SND_SOC_RT5645
+ select SND_SST_MFLD_PLATFORM
+ select SND_SST_IPC_ACPI
--- /dev/null
+From ec3995da27e782cc407ce48101c98c19c9ce738d Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Wed, 13 Jan 2016 23:14:54 +0100
+Subject: ASoC: mediatek: add i2c dependency
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit ec3995da27e782cc407ce48101c98c19c9ce738d upstream.
+
+The newly added mediatek drivers for mt8173 select codes that depend
+on I2C, which cuases a build failure if I2C is disabled:
+
+warning: (SND_SOC_ADAU1761_I2C && SND_SOC_ADAU1781_I2C && SND_SOC_ADAU1977_I2C && SND_SOC_RT5677 && EXTCON_MAX14577 && EXTCON_MAX77693 && EXTCON_MAX77843 && BMC150_ACCEL_I2C && BMG160_I2C) selects REGMAP_I2C which has unmet direct dependencies (I2C)
+codecs/rt5645.c:3854:1: warning: data definition has no type or storage class
+codecs/rt5645.c:3854:1: error: type defaults to 'int' in declaration of 'module_i2c_driver' [-Werror=implicit-int]
+codecs/rt5677.c:5270:1: warning: data definition has no type or storage class
+77_i2c_driver);
+
+codecs/rt5677.c:5270:1: error: type defaults to 'int' in declaration of 'module_i2c_driver' [-Werror=implicit-int]
+
+This adds an explicit dependency.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Acked-by: Koro Chen <koro.chen@mediatek.com>
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/soc/mediatek/Kconfig | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/sound/soc/mediatek/Kconfig
++++ b/sound/soc/mediatek/Kconfig
+@@ -9,7 +9,7 @@ config SND_SOC_MEDIATEK
+
+ config SND_SOC_MT8173_MAX98090
+ tristate "ASoC Audio driver for MT8173 with MAX98090 codec"
+- depends on SND_SOC_MEDIATEK
++ depends on SND_SOC_MEDIATEK && I2C
+ select SND_SOC_MAX98090
+ help
+ This adds ASoC driver for Mediatek MT8173 boards
+@@ -19,7 +19,7 @@ config SND_SOC_MT8173_MAX98090
+
+ config SND_SOC_MT8173_RT5650_RT5676
+ tristate "ASoC Audio driver for MT8173 with RT5650 RT5676 codecs"
+- depends on SND_SOC_MEDIATEK
++ depends on SND_SOC_MEDIATEK && I2C
+ select SND_SOC_RT5645
+ select SND_SOC_RT5677
+ help
--- /dev/null
+From d8fc2198aab117a4bc16ee305caef19c4c7e7f5c Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Wed, 2 Mar 2016 16:59:06 +0100
+Subject: ASoC: rockchip: use __maybe_unused to hide st_irq_syscfg_resume
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit d8fc2198aab117a4bc16ee305caef19c4c7e7f5c upstream.
+
+The rockchip spdif driver uses SIMPLE_DEV_PM_OPS to conditionally
+set its power management functions, but we get a warning
+about rk_spdif_runtime_resume being unused when CONFIG_PM is not
+set:
+
+sound/soc/rockchip/rockchip_spdif.c:67:12: error: 'rk_spdif_runtime_resume' defined but not used [-Werror=unused-function]
+
+This adds a __maybe_unused annotation so the compiler knows
+it can silently drop it instead of warning.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/soc/rockchip/rockchip_spdif.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/sound/soc/rockchip/rockchip_spdif.c
++++ b/sound/soc/rockchip/rockchip_spdif.c
+@@ -54,7 +54,7 @@ static const struct of_device_id rk_spdi
+ };
+ MODULE_DEVICE_TABLE(of, rk_spdif_match);
+
+-static int rk_spdif_runtime_suspend(struct device *dev)
++static int __maybe_unused rk_spdif_runtime_suspend(struct device *dev)
+ {
+ struct rk_spdif_dev *spdif = dev_get_drvdata(dev);
+
+@@ -64,7 +64,7 @@ static int rk_spdif_runtime_suspend(stru
+ return 0;
+ }
+
+-static int rk_spdif_runtime_resume(struct device *dev)
++static int __maybe_unused rk_spdif_runtime_resume(struct device *dev)
+ {
+ struct rk_spdif_dev *spdif = dev_get_drvdata(dev);
+ int ret;
--- /dev/null
+From 733d0def3ebdd1d088330d904149af21fa4b9ae2 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Tue, 26 Jan 2016 12:09:58 -0200
+Subject: [media] b2c2: flexcop: avoid unused function warnings
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit 733d0def3ebdd1d088330d904149af21fa4b9ae2 upstream.
+
+The flexcop driver has two functions that are normally used, except
+when multiple frontend drivers are disabled:
+
+drivers/media/common/b2c2/flexcop-fe-tuner.c:42:12: warning: 'flexcop_set_voltage' defined but not used [-Wunused-function]
+drivers/media/common/b2c2/flexcop-fe-tuner.c:71:12: warning: 'flexcop_sleep' defined but not used [-Wunused-function]
+
+This avoids the build warning by updating the #ifdef for flexcop_set_voltage
+to the exact condition under which it is used. For flexcop_sleep, the
+condition is rather complex, so I resort to marking it as __maybe_unused,
+so the compiler can silently drop it.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/media/common/b2c2/flexcop-fe-tuner.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/drivers/media/common/b2c2/flexcop-fe-tuner.c
++++ b/drivers/media/common/b2c2/flexcop-fe-tuner.c
+@@ -38,7 +38,7 @@ static int flexcop_fe_request_firmware(s
+ #endif
+
+ /* lnb control */
+-#if FE_SUPPORTED(MT312) || FE_SUPPORTED(STV0299)
++#if (FE_SUPPORTED(MT312) || FE_SUPPORTED(STV0299)) && FE_SUPPORTED(PLL)
+ static int flexcop_set_voltage(struct dvb_frontend *fe,
+ enum fe_sec_voltage voltage)
+ {
+@@ -68,7 +68,7 @@ static int flexcop_set_voltage(struct dv
+ #endif
+
+ #if FE_SUPPORTED(S5H1420) || FE_SUPPORTED(STV0299) || FE_SUPPORTED(MT312)
+-static int flexcop_sleep(struct dvb_frontend* fe)
++static int __maybe_unused flexcop_sleep(struct dvb_frontend* fe)
+ {
+ struct flexcop_device *fc = fe->dvb->priv;
+ if (fc->fe_sleep)
--- /dev/null
+From foo@baz Fri Feb 23 17:12:49 CET 2018
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Tue, 20 Feb 2018 12:54:52 +0100
+Subject: binfmt_elf: compat: avoid unused function warning
+To: stable@vger.kernel.org
+Cc: Greg KH <gregkh@linuxfoundation.org>, linux-kernel@vger.kernel.org, Arnd Bergmann <arnd@arndb.de>, Alexander Viro <viro@zeniv.linux.org.uk>, linux-fsdevel@vger.kernel.org
+Message-ID: <20180220115527.1806578-6-arnd@arndb.de>
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+When CONFIG_ELF_CORE is disabled, we get a harmless warning in the compat
+version of binfmt_elf:
+
+fs/compat_binfmt_elf.c:58:13: error: 'cputime_to_compat_timeval' defined but not used [-Werror=unused-function]
+
+This was addressed in mainline Linux as part of a larger rework with commit
+cd19c364b313 ("fs/binfmt: Convert obsolete cputime type to nsecs").
+
+For 4.9 and earlier, this just shuts up the warning by adding an #ifdef
+around the function definition.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/compat_binfmt_elf.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/fs/compat_binfmt_elf.c
++++ b/fs/compat_binfmt_elf.c
+@@ -51,6 +51,7 @@
+ #define elf_prstatus compat_elf_prstatus
+ #define elf_prpsinfo compat_elf_prpsinfo
+
++#ifdef CONFIG_ELF_CORE
+ /*
+ * Compat version of cputime_to_compat_timeval, perhaps this
+ * should be an inline in <linux/compat.h>.
+@@ -63,6 +64,7 @@ static void cputime_to_compat_timeval(co
+ value->tv_sec = tv.tv_sec;
+ value->tv_usec = tv.tv_usec;
+ }
++#endif
+
+ #undef cputime_to_timeval
+ #define cputime_to_timeval cputime_to_compat_timeval
--- /dev/null
+From 7fc1503c906f0fac62d3506a6e993e49fb996248 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Tue, 25 Oct 2016 22:21:04 +0200
+Subject: cw1200: fix bogus maybe-uninitialized warning
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit 7fc1503c906f0fac62d3506a6e993e49fb996248 upstream.
+
+On x86, the cw1200 driver produces a rather silly warning about the
+possible use of the 'ret' variable without an initialization
+presumably after being confused by the architecture specific definition
+of WARN_ON:
+
+drivers/net/wireless/st/cw1200/wsm.c: In function ‘wsm_handle_rx’:
+drivers/net/wireless/st/cw1200/wsm.c:1457:9: error: ‘ret’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
+
+We have already checked that 'count' is larger than 0 here, so
+we know that 'ret' is initialized. Changing the 'for' loop
+into do/while also makes this clear to the compiler.
+
+Suggested-by: David Laight <David.Laight@ACULAB.COM>
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/net/wireless/cw1200/wsm.c | 8 +++-----
+ 1 file changed, 3 insertions(+), 5 deletions(-)
+
+--- a/drivers/net/wireless/cw1200/wsm.c
++++ b/drivers/net/wireless/cw1200/wsm.c
+@@ -379,7 +379,6 @@ static int wsm_multi_tx_confirm(struct c
+ {
+ int ret;
+ int count;
+- int i;
+
+ count = WSM_GET32(buf);
+ if (WARN_ON(count <= 0))
+@@ -395,11 +394,10 @@ static int wsm_multi_tx_confirm(struct c
+ }
+
+ cw1200_debug_txed_multi(priv, count);
+- for (i = 0; i < count; ++i) {
++ do {
+ ret = wsm_tx_confirm(priv, buf, link_id);
+- if (ret)
+- return ret;
+- }
++ } while (!ret && --count);
++
+ return ret;
+
+ underflow:
--- /dev/null
+From foo@baz Fri Feb 23 17:12:49 CET 2018
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Tue, 20 Feb 2018 12:55:00 +0100
+Subject: dell-wmi, dell-laptop: depends DMI
+To: stable@vger.kernel.org
+Cc: "Greg KH" <gregkh@linuxfoundation.org>, linux-kernel@vger.kernel.org, "Andy Lutomirski" <luto@kernel.org>, "Arnd Bergmann" <arnd@arndb.de>, "Darren Hart" <dvhart@linux.intel.com>, "Darren Hart" <dvhart@infradead.org>, "Pali Rohár" <pali.rohar@gmail.com>, platform-driver-x86@vger.kernel.org
+Message-ID: <20180220115527.1806578-14-arnd@arndb.de>
+
+From: Andy Lutomirski <luto@kernel.org>
+
+commit a570af4850043260b87fb1b8aa27a4484e648878 upstream.
+
+dell-wmi and dell-laptop will compile but won't work right if DMI
+isn't selected.
+
+Signed-off-by: Andy Lutomirski <luto@kernel.org>
+Acked-by: Pali Rohár <pali.rohar@gmail.com>
+[arnd: Use depends instead of selects to avoid recursive dependencies]
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Darren Hart <dvhart@linux.intel.com>
+[arnd: rebase to 4.4-stable]
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/platform/x86/Kconfig | 2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/drivers/platform/x86/Kconfig
++++ b/drivers/platform/x86/Kconfig
+@@ -95,6 +95,7 @@ config DELL_LAPTOP
+ tristate "Dell Laptop Extras"
+ depends on X86
+ depends on DCDBAS
++ depends on DMI
+ depends on BACKLIGHT_CLASS_DEVICE
+ depends on ACPI_VIDEO || ACPI_VIDEO = n
+ depends on RFKILL || RFKILL = n
+@@ -110,6 +111,7 @@ config DELL_LAPTOP
+ config DELL_WMI
+ tristate "Dell WMI extras"
+ depends on ACPI_WMI
++ depends on DMI
+ depends on INPUT
+ depends on ACPI_VIDEO || ACPI_VIDEO = n
+ select INPUT_SPARSEKMAP
--- /dev/null
+From 067fdeb2f391bfa071f741a2b3eb74b8ff3785cd Mon Sep 17 00:00:00 2001
+From: Jun Nie <jun.nie@linaro.org>
+Date: Tue, 10 Jan 2017 17:23:40 +0800
+Subject: dmaengine: zx: fix build warning
+
+From: Jun Nie <jun.nie@linaro.org>
+
+commit 067fdeb2f391bfa071f741a2b3eb74b8ff3785cd upstream.
+
+Fix build warning that related to PAGE_SIZE. The maximum DMA
+length has nothing to do with PAGE_SIZE, just use a fix number
+for the definition.
+
+drivers/dma/zx_dma.c: In function 'zx_dma_prep_memcpy':
+drivers/dma/zx_dma.c:523:8: warning: division by zero [-Wdiv-by-zero]
+drivers/dma/zx_dma.c: In function 'zx_dma_prep_slave_sg':
+drivers/dma/zx_dma.c:567:11: warning: division by zero [-Wdiv-by-zero]
+
+Signed-off-by: Jun Nie <jun.nie@linaro.org>
+Tested-by: Shawn Guo <shawn.guo@linaro.org>
+Signed-off-by: Vinod Koul <vinod.koul@intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/dma/zx296702_dma.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/dma/zx296702_dma.c
++++ b/drivers/dma/zx296702_dma.c
+@@ -26,7 +26,7 @@
+
+ #define DRIVER_NAME "zx-dma"
+ #define DMA_ALIGN 4
+-#define DMA_MAX_SIZE (0x10000 - PAGE_SIZE)
++#define DMA_MAX_SIZE (0x10000 - 512)
+ #define LLI_BLOCK_SIZE (4 * PAGE_SIZE)
+
+ #define REG_ZX_SRC_ADDR 0x00
--- /dev/null
+From foo@baz Fri Feb 23 17:23:58 CET 2018
+From: Jack Wang <jinpu.wang@profitbricks.com>
+Date: Fri, 23 Feb 2018 11:41:59 +0100
+Subject: Documentation: Document array_index_nospec
+To: gregkh@linuxfoundation.org, stable@vger.kernel.org
+Cc: Mark Rutland <mark.rutland@arm.com>, Will Deacon <will.deacon@arm.com>, Dan Williams <dan.j.williams@intel.com>, Thomas Gleixner <tglx@linutronix.de>, linux-arch@vger.kernel.org, Jonathan Corbet <corbet@lwn.net>, Peter Zijlstra <peterz@infradead.org>, kernel-hardening@lists.openwall.com, torvalds@linux-foundation.org, alan@linux.intel.com, David Woodhouse <dwmw@amazon.co.uk>, Jack Wang <jinpu.wang@profitbricks.com>
+Message-ID: <1519382538-15143-11-git-send-email-jinpu.wangl@profitbricks.com>
+
+From: Mark Rutland <mark.rutland@arm.com>
+
+(cherry picked from commit f84a56f73dddaeac1dba8045b007f742f61cd2da)
+
+Document the rationale and usage of the new array_index_nospec() helper.
+
+Signed-off-by: Mark Rutland <mark.rutland@arm.com>
+Signed-off-by: Will Deacon <will.deacon@arm.com>
+Signed-off-by: Dan Williams <dan.j.williams@intel.com>
+Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
+Reviewed-by: Kees Cook <keescook@chromium.org>
+Cc: linux-arch@vger.kernel.org
+Cc: Jonathan Corbet <corbet@lwn.net>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: gregkh@linuxfoundation.org
+Cc: kernel-hardening@lists.openwall.com
+Cc: torvalds@linux-foundation.org
+Cc: alan@linux.intel.com
+Link: https://lkml.kernel.org/r/151727413645.33451.15878817161436755393.stgit@dwillia2-desk3.amr.corp.intel.com
+Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
+[jwang: cherry pick to 4.4]
+Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ Documentation/speculation.txt | 90 ++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 90 insertions(+)
+ create mode 100644 Documentation/speculation.txt
+
+--- /dev/null
++++ b/Documentation/speculation.txt
+@@ -0,0 +1,90 @@
++This document explains potential effects of speculation, and how undesirable
++effects can be mitigated portably using common APIs.
++
++===========
++Speculation
++===========
++
++To improve performance and minimize average latencies, many contemporary CPUs
++employ speculative execution techniques such as branch prediction, performing
++work which may be discarded at a later stage.
++
++Typically speculative execution cannot be observed from architectural state,
++such as the contents of registers. However, in some cases it is possible to
++observe its impact on microarchitectural state, such as the presence or
++absence of data in caches. Such state may form side-channels which can be
++observed to extract secret information.
++
++For example, in the presence of branch prediction, it is possible for bounds
++checks to be ignored by code which is speculatively executed. Consider the
++following code:
++
++ int load_array(int *array, unsigned int index)
++ {
++ if (index >= MAX_ARRAY_ELEMS)
++ return 0;
++ else
++ return array[index];
++ }
++
++Which, on arm64, may be compiled to an assembly sequence such as:
++
++ CMP <index>, #MAX_ARRAY_ELEMS
++ B.LT less
++ MOV <returnval>, #0
++ RET
++ less:
++ LDR <returnval>, [<array>, <index>]
++ RET
++
++It is possible that a CPU mis-predicts the conditional branch, and
++speculatively loads array[index], even if index >= MAX_ARRAY_ELEMS. This
++value will subsequently be discarded, but the speculated load may affect
++microarchitectural state which can be subsequently measured.
++
++More complex sequences involving multiple dependent memory accesses may
++result in sensitive information being leaked. Consider the following
++code, building on the prior example:
++
++ int load_dependent_arrays(int *arr1, int *arr2, int index)
++ {
++ int val1, val2,
++
++ val1 = load_array(arr1, index);
++ val2 = load_array(arr2, val1);
++
++ return val2;
++ }
++
++Under speculation, the first call to load_array() may return the value
++of an out-of-bounds address, while the second call will influence
++microarchitectural state dependent on this value. This may provide an
++arbitrary read primitive.
++
++====================================
++Mitigating speculation side-channels
++====================================
++
++The kernel provides a generic API to ensure that bounds checks are
++respected even under speculation. Architectures which are affected by
++speculation-based side-channels are expected to implement these
++primitives.
++
++The array_index_nospec() helper in <linux/nospec.h> can be used to
++prevent information from being leaked via side-channels.
++
++A call to array_index_nospec(index, size) returns a sanitized index
++value that is bounded to [0, size) even under cpu speculation
++conditions.
++
++This can be used to protect the earlier load_array() example:
++
++ int load_array(int *array, unsigned int index)
++ {
++ if (index >= MAX_ARRAY_ELEMS)
++ return 0;
++ else {
++ index = array_index_nospec(index, MAX_ARRAY_ELEMS);
++ return array[index];
++ }
++ }
--- /dev/null
+From f50abb9b63b1d8773e1ce32115701c06416e6f91 Mon Sep 17 00:00:00 2001
+From: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
+Date: Thu, 18 Feb 2016 13:59:13 +0530
+Subject: dpt_i2o: fix build warning
+
+From: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
+
+commit f50abb9b63b1d8773e1ce32115701c06416e6f91 upstream.
+
+We were getting build warning about:
+drivers/scsi/dpt_i2o.c:183:29: warning: 'dptids' defined but not used
+
+dptids[] is only used in the MODULE_DEVICE_TABLE so when MODULE is not
+defined then dptids[] becomes unused.
+
+Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
+Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/scsi/dpt_i2o.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+--- a/drivers/scsi/dpt_i2o.c
++++ b/drivers/scsi/dpt_i2o.c
+@@ -180,11 +180,14 @@ static u8 adpt_read_blink_led(adpt_hba*
+ *============================================================================
+ */
+
++#ifdef MODULE
+ static struct pci_device_id dptids[] = {
+ { PCI_DPT_VENDOR_ID, PCI_DPT_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,},
+ { PCI_DPT_VENDOR_ID, PCI_DPT_RAPTOR_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,},
+ { 0, }
+ };
++#endif
++
+ MODULE_DEVICE_TABLE(pci,dptids);
+
+ static int adpt_detect(struct scsi_host_template* sht)
--- /dev/null
+From 1f62ff34a90471d1b735bac2c79e894afc7c59bc Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Thu, 24 Mar 2016 22:19:40 +0100
+Subject: driver-core: use 'dev' argument in dev_dbg_ratelimited stub
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit 1f62ff34a90471d1b735bac2c79e894afc7c59bc upstream.
+
+dev_dbg_ratelimited() is a macro that ignores its first argument when DEBUG is
+not set, which can lead to unused variable warnings:
+
+ethernet/mellanox/mlxsw/pci.c: In function 'mlxsw_pci_cqe_sdq_handle':
+ethernet/mellanox/mlxsw/pci.c:646:18: warning: unused variable 'pdev' [-Wunused-variable]
+ethernet/mellanox/mlxsw/pci.c: In function 'mlxsw_pci_cqe_rdq_handle':
+ethernet/mellanox/mlxsw/pci.c:671:18: warning: unused variable 'pdev' [-Wunused-variable]
+
+The macro already ensures that all its other arguments are silently
+ignored by the compiler without triggering a warning, through the
+use of the no_printk() macro, but the dev argument is not passed into
+that.
+
+This changes the definition to use the same trick as no_printk() with
+an if(0) that leads the compiler to not evaluate the side-effects but
+still see that 'dev' might not be unused.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Suggested-by: Andrew Lunn <andrew@lunn.ch>
+Fixes: 6f586e663e3b ("driver-core: Shut up dev_dbg_reatelimited() without DEBUG")
+Reviewed-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ include/linux/device.h | 7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+--- a/include/linux/device.h
++++ b/include/linux/device.h
+@@ -1272,8 +1272,11 @@ do { \
+ dev_printk(KERN_DEBUG, dev, fmt, ##__VA_ARGS__); \
+ } while (0)
+ #else
+-#define dev_dbg_ratelimited(dev, fmt, ...) \
+- no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
++#define dev_dbg_ratelimited(dev, fmt, ...) \
++do { \
++ if (0) \
++ dev_printk(KERN_DEBUG, dev, fmt, ##__VA_ARGS__); \
++} while (0)
+ #endif
+
+ #ifdef VERBOSE_DEBUG
--- /dev/null
+From 9220e39b5c900c67ddcb517d52fe52d90fb5e3c8 Mon Sep 17 00:00:00 2001
+From: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
+Date: Fri, 11 Dec 2015 14:23:11 +0530
+Subject: Drivers: hv: vmbus: fix build warning
+
+From: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
+
+commit 9220e39b5c900c67ddcb517d52fe52d90fb5e3c8 upstream.
+
+We were getting build warning about unused variable "tsc_msr" and
+"va_tsc" while building for i386 allmodconfig.
+
+Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/hv/hv.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+--- a/drivers/hv/hv.c
++++ b/drivers/hv/hv.c
+@@ -195,9 +195,7 @@ int hv_init(void)
+ {
+ int max_leaf;
+ union hv_x64_msr_hypercall_contents hypercall_msr;
+- union hv_x64_msr_hypercall_contents tsc_msr;
+ void *virtaddr = NULL;
+- void *va_tsc = NULL;
+
+ memset(hv_context.synic_event_page, 0, sizeof(void *) * NR_CPUS);
+ memset(hv_context.synic_message_page, 0,
+@@ -243,6 +241,9 @@ int hv_init(void)
+
+ #ifdef CONFIG_X86_64
+ if (ms_hyperv.features & HV_X64_MSR_REFERENCE_TSC_AVAILABLE) {
++ union hv_x64_msr_hypercall_contents tsc_msr;
++ void *va_tsc;
++
+ va_tsc = __vmalloc(PAGE_SIZE, GFP_KERNEL, PAGE_KERNEL);
+ if (!va_tsc)
+ goto cleanup;
--- /dev/null
+From cb4396edd84ed73081635fb933d19c1410fafaf4 Mon Sep 17 00:00:00 2001
+From: Fabian Frederick <fabf@skynet.be>
+Date: Sat, 12 Dec 2015 18:24:38 +0100
+Subject: drivers/net: fix eisa_driver probe section mismatch
+
+From: Fabian Frederick <fabf@skynet.be>
+
+commit cb4396edd84ed73081635fb933d19c1410fafaf4 upstream.
+
+Some eisa_driver structures used __init probe functions which generates
+a warning and could crash if function is called after being deleted.
+
+Signed-off-by: Fabian Frederick <fabf@skynet.be>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/net/ethernet/3com/3c509.c | 2 +-
+ drivers/net/ethernet/3com/3c59x.c | 2 +-
+ drivers/net/ethernet/dec/tulip/de4x5.c | 2 +-
+ drivers/net/ethernet/hp/hp100.c | 2 +-
+ 4 files changed, 4 insertions(+), 4 deletions(-)
+
+--- a/drivers/net/ethernet/3com/3c509.c
++++ b/drivers/net/ethernet/3com/3c509.c
+@@ -562,7 +562,7 @@ static void el3_common_remove (struct ne
+ }
+
+ #ifdef CONFIG_EISA
+-static int __init el3_eisa_probe (struct device *device)
++static int el3_eisa_probe(struct device *device)
+ {
+ short i;
+ int ioaddr, irq, if_port;
+--- a/drivers/net/ethernet/3com/3c59x.c
++++ b/drivers/net/ethernet/3com/3c59x.c
+@@ -907,7 +907,7 @@ static struct eisa_device_id vortex_eisa
+ };
+ MODULE_DEVICE_TABLE(eisa, vortex_eisa_ids);
+
+-static int __init vortex_eisa_probe(struct device *device)
++static int vortex_eisa_probe(struct device *device)
+ {
+ void __iomem *ioaddr;
+ struct eisa_device *edev;
+--- a/drivers/net/ethernet/dec/tulip/de4x5.c
++++ b/drivers/net/ethernet/dec/tulip/de4x5.c
+@@ -1990,7 +1990,7 @@ SetMulticastFilter(struct net_device *de
+
+ static u_char de4x5_irq[] = EISA_ALLOWED_IRQ_LIST;
+
+-static int __init de4x5_eisa_probe (struct device *gendev)
++static int de4x5_eisa_probe(struct device *gendev)
+ {
+ struct eisa_device *edev;
+ u_long iobase;
+--- a/drivers/net/ethernet/hp/hp100.c
++++ b/drivers/net/ethernet/hp/hp100.c
+@@ -2843,7 +2843,7 @@ static void cleanup_dev(struct net_devic
+ }
+
+ #ifdef CONFIG_EISA
+-static int __init hp100_eisa_probe (struct device *gendev)
++static int hp100_eisa_probe(struct device *gendev)
+ {
+ struct net_device *dev = alloc_etherdev(sizeof(struct hp100_private));
+ struct eisa_device *edev = to_eisa_device(gendev);
--- /dev/null
+From foo@baz Fri Feb 23 17:12:49 CET 2018
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Tue, 20 Feb 2018 12:55:08 +0100
+Subject: drm/gma500: remove helper function
+To: stable@vger.kernel.org
+Cc: Greg KH <gregkh@linuxfoundation.org>, linux-kernel@vger.kernel.org, Sudip Mukherjee <sudipm.mukherjee@gmail.com>, Sudip Mukherjee <sudip@vectorindia.org>, Daniel Vetter <daniel.vetter@intel.com>, Arnd Bergmann <arnd@arndb.de>, Patrik Jakobsson <patrik.r.jakobsson@gmail.com>, David Airlie <airlied@linux.ie>, dri-devel@lists.freedesktop.org
+Message-ID: <20180220115527.1806578-22-arnd@arndb.de>
+
+From: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
+
+commit db9b60400f9253c25ae639797df2d0ff7a35d9d8 upstream.
+
+We were getting build warning about:
+drivers/gpu/drm/gma500/mdfld_dsi_output.c:407:2: warning: initialization
+ from incompatible pointer type
+
+The callback to dpms was pointing to a helper function which had a
+return type of void, whereas the callback should point to a function
+which has a return type of int.
+On closer look it turned out that we do not need the helper function
+since if we call drm_helper_connector_dpms() directly, the first check
+that drm_helper_connector_dpms() does is: if (mode == connector->dpms)
+
+Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
+Link: http://patchwork.freedesktop.org/patch/msgid/1454393155-13142-1-git-send-email-sudipm.mukherjee@gmail.com
+Acked-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
+Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
+[arnd: rebased to 4.4]
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/gpu/drm/gma500/mdfld_dsi_output.c | 12 +-----------
+ 1 file changed, 1 insertion(+), 11 deletions(-)
+
+--- a/drivers/gpu/drm/gma500/mdfld_dsi_output.c
++++ b/drivers/gpu/drm/gma500/mdfld_dsi_output.c
+@@ -382,16 +382,6 @@ static int mdfld_dsi_connector_mode_vali
+ return MODE_OK;
+ }
+
+-static void mdfld_dsi_connector_dpms(struct drm_connector *connector, int mode)
+-{
+- if (mode == connector->dpms)
+- return;
+-
+- /*first, execute dpms*/
+-
+- drm_helper_connector_dpms(connector, mode);
+-}
+-
+ static struct drm_encoder *mdfld_dsi_connector_best_encoder(
+ struct drm_connector *connector)
+ {
+@@ -404,7 +394,7 @@ static struct drm_encoder *mdfld_dsi_con
+
+ /*DSI connector funcs*/
+ static const struct drm_connector_funcs mdfld_dsi_connector_funcs = {
+- .dpms = /*drm_helper_connector_dpms*/mdfld_dsi_connector_dpms,
++ .dpms = drm_helper_connector_dpms,
+ .save = mdfld_dsi_connector_save,
+ .restore = mdfld_dsi_connector_restore,
+ .detect = mdfld_dsi_connector_detect,
--- /dev/null
+From 4f250706211cdb949f7580d4fe4dd1fd646de693 Mon Sep 17 00:00:00 2001
+From: Thierry Reding <treding@nvidia.com>
+Date: Tue, 15 Dec 2015 12:20:49 +0100
+Subject: drm/gma500: Sanity-check pipe index
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Thierry Reding <treding@nvidia.com>
+
+commit 4f250706211cdb949f7580d4fe4dd1fd646de693 upstream.
+
+If the DSI output isn't connected, then mdfld_dsi_encoder_get_pipe()
+will return -1. The mdfld_dsi_dp_mode_set() function doesn't properly
+check for this condition and causes the following compiler warnings:
+
+ CC drivers/gpu/drm/gma500/mdfld_dsi_dpi.o
+ drivers/gpu/drm/gma500/mdfld_dsi_dpi.c: In function ‘mdfld_dsi_dpi_mode_set’:
+ drivers/gpu/drm/gma500/mdfld_dsi_dpi.c:828:35: warning: array subscript is below array bounds [-Warray-bounds]
+ u32 pipeconf = dev_priv->pipeconf[pipe];
+ ^
+ drivers/gpu/drm/gma500/mdfld_dsi_dpi.c:829:33: warning: array subscript is below array bounds [-Warray-bounds]
+ u32 dspcntr = dev_priv->dspcntr[pipe];
+ ^
+
+Fix this by checking for a valid pipe before indexing the pipeconf and
+dspcntr arrays.
+
+Cc: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
+Reviewed-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
+Signed-off-by: Thierry Reding <treding@nvidia.com>
+Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
+Link: http://patchwork.freedesktop.org/patch/msgid/1450178476-26284-2-git-send-email-boris.brezillon@free-electrons.com
+Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/gpu/drm/gma500/mdfld_dsi_dpi.c | 10 +++++++---
+ 1 file changed, 7 insertions(+), 3 deletions(-)
+
+--- a/drivers/gpu/drm/gma500/mdfld_dsi_dpi.c
++++ b/drivers/gpu/drm/gma500/mdfld_dsi_dpi.c
+@@ -821,14 +821,18 @@ void mdfld_dsi_dpi_mode_set(struct drm_e
+ struct drm_device *dev = dsi_config->dev;
+ struct drm_psb_private *dev_priv = dev->dev_private;
+ int pipe = mdfld_dsi_encoder_get_pipe(dsi_encoder);
+-
+ u32 pipeconf_reg = PIPEACONF;
+ u32 dspcntr_reg = DSPACNTR;
++ u32 pipeconf, dspcntr;
+
+- u32 pipeconf = dev_priv->pipeconf[pipe];
+- u32 dspcntr = dev_priv->dspcntr[pipe];
+ u32 mipi = MIPI_PORT_EN | PASS_FROM_SPHY_TO_AFE | SEL_FLOPPED_HSTX;
+
++ if (WARN_ON(pipe < 0))
++ return;
++
++ pipeconf = dev_priv->pipeconf[pipe];
++ dspcntr = dev_priv->dspcntr[pipe];
++
+ if (pipe) {
+ pipeconf_reg = PIPECCONF;
+ dspcntr_reg = DSPCCNTR;
--- /dev/null
+From b74c0a9969f25217a5e5bbcac56a11bee16718d3 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Mon, 24 Oct 2016 17:30:38 +0200
+Subject: drm/nouveau: hide gcc-4.9 -Wmaybe-uninitialized
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit b74c0a9969f25217a5e5bbcac56a11bee16718d3 upstream.
+
+gcc-4.9 notices that the validate_init() function returns unintialized
+data when called with a zero 'nr_buffers' argument, when called with the
+-Wmaybe-uninitialized flag:
+
+drivers/gpu/drm/nouveau/nouveau_gem.c: In function ‘validate_init.isra.6’:
+drivers/gpu/drm/nouveau/nouveau_gem.c:457:5: error: ‘ret’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
+
+However, the only caller of this function always passes a nonzero
+argument, and gcc-6 is clever enough to take this into account and
+not warn about it any more.
+
+Adding an explicit initialization to -EINVAL here is correct even if
+the caller changed, and it avoids the warning on gcc-4.9 as well.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Reviewed-By: Karol Herbst <karolherbst@gmail.com>
+Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/gpu/drm/nouveau/nouveau_gem.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/gpu/drm/nouveau/nouveau_gem.c
++++ b/drivers/gpu/drm/nouveau/nouveau_gem.c
+@@ -370,7 +370,7 @@ validate_init(struct nouveau_channel *ch
+ struct nouveau_cli *cli = nouveau_cli(file_priv);
+ struct drm_device *dev = chan->drm->dev;
+ int trycnt = 0;
+- int ret, i;
++ int ret = -EINVAL, i;
+ struct nouveau_bo *res_bo = NULL;
+ LIST_HEAD(gart_list);
+ LIST_HEAD(vram_list);
--- /dev/null
+From 0e7c875d1ae9dcf4d8c6018a45e5529feaef8956 Mon Sep 17 00:00:00 2001
+From: Paul Bolle <pebolle@tiscali.nl>
+Date: Thu, 3 Mar 2016 11:26:10 +0100
+Subject: drm/vmwgfx: use *_32_bits() macros
+
+From: Paul Bolle <pebolle@tiscali.nl>
+
+commit 0e7c875d1ae9dcf4d8c6018a45e5529feaef8956 upstream.
+
+Use the upper_32_bits() macro instead of the four line equivalent that
+triggers a GCC warning on 32 bits x86:
+ drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c: In function 'vmw_cmdbuf_header_submit':
+ drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c:297:25: warning: right shift count >= width of type [-Wshift-count-overflow]
+ val = (header->handle >> 32);
+ ^
+
+And use the lower_32_bits() macro instead of and-ing with a 32 bits
+mask.
+
+Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
+Acked-by: Joe Perches <joe@perches.com>
+Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
+Link: http://patchwork.freedesktop.org/patch/msgid/1457000770-2317-1-git-send-email-pebolle@tiscali.nl
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c | 7 ++-----
+ 1 file changed, 2 insertions(+), 5 deletions(-)
+
+--- a/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c
++++ b/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c
+@@ -293,13 +293,10 @@ static int vmw_cmdbuf_header_submit(stru
+ struct vmw_cmdbuf_man *man = header->man;
+ u32 val;
+
+- if (sizeof(header->handle) > 4)
+- val = (header->handle >> 32);
+- else
+- val = 0;
++ val = upper_32_bits(header->handle);
+ vmw_write(man->dev_priv, SVGA_REG_COMMAND_HIGH, val);
+
+- val = (header->handle & 0xFFFFFFFFULL);
++ val = lower_32_bits(header->handle);
+ val |= header->cb_context & SVGA_CB_CONTEXT_MASK;
+ vmw_write(man->dev_priv, SVGA_REG_COMMAND_LOW, val);
+
--- /dev/null
+From 190b23b4eb997767afad186bd8c96badceabf39e Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Tue, 26 Jan 2016 12:09:59 -0200
+Subject: [media] em28xx: only use mt9v011 if camera support is enabled
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit 190b23b4eb997767afad186bd8c96badceabf39e upstream.
+
+In randconfig builds that select VIDEO_EM28XX_V4L2 and
+MEDIA_SUBDRV_AUTOSELECT, but not MEDIA_CAMERA_SUPPORT, we get
+a Kconfig warning:
+
+ warning: (VIDEO_EM28XX_V4L2) selects VIDEO_MT9V011 which has unmet direct dependencies (MEDIA_SUPPORT && I2C && VIDEO_V4L2 && MEDIA_CAMERA_SUPPORT)
+
+This avoids the warning by making that 'select' conditional on
+MEDIA_CAMERA_SUPPORT. Alternatively we could mark EM28XX as
+'depends on MEDIA_CAMERA_SUPPORT', but it does not seem to
+have any real dependency on that itself.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/media/usb/em28xx/Kconfig | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/media/usb/em28xx/Kconfig
++++ b/drivers/media/usb/em28xx/Kconfig
+@@ -11,7 +11,7 @@ config VIDEO_EM28XX_V4L2
+ select VIDEO_SAA711X if MEDIA_SUBDRV_AUTOSELECT
+ select VIDEO_TVP5150 if MEDIA_SUBDRV_AUTOSELECT
+ select VIDEO_MSP3400 if MEDIA_SUBDRV_AUTOSELECT
+- select VIDEO_MT9V011 if MEDIA_SUBDRV_AUTOSELECT
++ select VIDEO_MT9V011 if MEDIA_SUBDRV_AUTOSELECT && MEDIA_CAMERA_SUPPORT
+
+ ---help---
+ This is a video4linux driver for Empia 28xx based TV cards.
--- /dev/null
+From a8a31afad5ffa1c7de0cef1c4bc383b50f426bf8 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Fri, 20 Nov 2015 22:47:41 +0100
+Subject: fbdev: auo_k190x: avoid unused function warnings
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit a8a31afad5ffa1c7de0cef1c4bc383b50f426bf8 upstream.
+
+The auo_k190x framebuffer driver encloses the power-management
+functions in #ifdef CONFIG_PM, but the auok190x_suspend/resume
+functions are only really used when CONFIG_PM_SLEEP is also
+set, as a frequent gcc warning shows:
+
+drivers/video/fbdev/auo_k190x.c:859:12: warning: 'auok190x_suspend' defined but not used
+drivers/video/fbdev/auo_k190x.c:899:12: warning: 'auok190x_resume' defined but not used
+
+This changes the driver to remove the #ifdef and instead mark
+the functions as __maybe_unused, which is a nicer anyway, as it
+provides build testing for all the code in all configurations
+and is harder to get wrong.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/video/fbdev/auo_k190x.c | 11 ++++-------
+ 1 file changed, 4 insertions(+), 7 deletions(-)
+
+--- a/drivers/video/fbdev/auo_k190x.c
++++ b/drivers/video/fbdev/auo_k190x.c
+@@ -773,9 +773,7 @@ static void auok190x_recover(struct auok
+ /*
+ * Power-management
+ */
+-
+-#ifdef CONFIG_PM
+-static int auok190x_runtime_suspend(struct device *dev)
++static int __maybe_unused auok190x_runtime_suspend(struct device *dev)
+ {
+ struct platform_device *pdev = to_platform_device(dev);
+ struct fb_info *info = platform_get_drvdata(pdev);
+@@ -822,7 +820,7 @@ finish:
+ return 0;
+ }
+
+-static int auok190x_runtime_resume(struct device *dev)
++static int __maybe_unused auok190x_runtime_resume(struct device *dev)
+ {
+ struct platform_device *pdev = to_platform_device(dev);
+ struct fb_info *info = platform_get_drvdata(pdev);
+@@ -856,7 +854,7 @@ static int auok190x_runtime_resume(struc
+ return 0;
+ }
+
+-static int auok190x_suspend(struct device *dev)
++static int __maybe_unused auok190x_suspend(struct device *dev)
+ {
+ struct platform_device *pdev = to_platform_device(dev);
+ struct fb_info *info = platform_get_drvdata(pdev);
+@@ -896,7 +894,7 @@ static int auok190x_suspend(struct devic
+ return 0;
+ }
+
+-static int auok190x_resume(struct device *dev)
++static int __maybe_unused auok190x_resume(struct device *dev)
+ {
+ struct platform_device *pdev = to_platform_device(dev);
+ struct fb_info *info = platform_get_drvdata(pdev);
+@@ -933,7 +931,6 @@ static int auok190x_resume(struct device
+
+ return 0;
+ }
+-#endif
+
+ const struct dev_pm_ops auok190x_pm = {
+ SET_RUNTIME_PM_OPS(auok190x_runtime_suspend, auok190x_runtime_resume,
--- /dev/null
+From b54729b6cea7d1f46b1ed70cb7065c6bdefaa780 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Mon, 25 Jan 2016 16:04:03 +0100
+Subject: fbdev: s6e8ax0: avoid unused function warnings
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit b54729b6cea7d1f46b1ed70cb7065c6bdefaa780 upstream.
+
+The s6e8ax0 suspend/resume functions are hidden inside of an #ifdef
+when CONFIG_PM is set to avoid unused function warnings, but they
+call some other functions that nothing else calls, and we get warnings
+about those:
+
+drivers/video/fbdev/exynos/s6e8ax0.c:449:13: error: 's6e8ax0_sleep_in' defined but not used [-Werror=unused-function]
+drivers/video/fbdev/exynos/s6e8ax0.c:485:13: error: 's6e8ax0_display_off' defined but not used [-Werror=unused-function]
+
+This marks the PM functions as __maybe_unused so the compiler can
+silently drop them when they are not referenced.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
+Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/video/fbdev/exynos/s6e8ax0.c | 13 ++++---------
+ 1 file changed, 4 insertions(+), 9 deletions(-)
+
+--- a/drivers/video/fbdev/exynos/s6e8ax0.c
++++ b/drivers/video/fbdev/exynos/s6e8ax0.c
+@@ -829,8 +829,7 @@ static int s6e8ax0_probe(struct mipi_dsi
+ return 0;
+ }
+
+-#ifdef CONFIG_PM
+-static int s6e8ax0_suspend(struct mipi_dsim_lcd_device *dsim_dev)
++static int __maybe_unused s6e8ax0_suspend(struct mipi_dsim_lcd_device *dsim_dev)
+ {
+ struct s6e8ax0 *lcd = dev_get_drvdata(&dsim_dev->dev);
+
+@@ -843,7 +842,7 @@ static int s6e8ax0_suspend(struct mipi_d
+ return 0;
+ }
+
+-static int s6e8ax0_resume(struct mipi_dsim_lcd_device *dsim_dev)
++static int __maybe_unused s6e8ax0_resume(struct mipi_dsim_lcd_device *dsim_dev)
+ {
+ struct s6e8ax0 *lcd = dev_get_drvdata(&dsim_dev->dev);
+
+@@ -855,10 +854,6 @@ static int s6e8ax0_resume(struct mipi_ds
+
+ return 0;
+ }
+-#else
+-#define s6e8ax0_suspend NULL
+-#define s6e8ax0_resume NULL
+-#endif
+
+ static struct mipi_dsim_lcd_driver s6e8ax0_dsim_ddi_driver = {
+ .name = "s6e8ax0",
+@@ -867,8 +862,8 @@ static struct mipi_dsim_lcd_driver s6e8a
+ .power_on = s6e8ax0_power_on,
+ .set_sequence = s6e8ax0_set_sequence,
+ .probe = s6e8ax0_probe,
+- .suspend = s6e8ax0_suspend,
+- .resume = s6e8ax0_resume,
++ .suspend = IS_ENABLED(CONFIG_PM) ? s6e8ax0_suspend : NULL,
++ .resume = IS_ENABLED(CONFIG_PM) ? s6e8ax0_resume : NULL,
+ };
+
+ static int s6e8ax0_init(void)
--- /dev/null
+From 5b833fea4377577eafecb888141a05470922ef25 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Fri, 27 Nov 2015 15:33:11 +0100
+Subject: fbdev: sis: enforce selection of at least one backend
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit 5b833fea4377577eafecb888141a05470922ef25 upstream.
+
+The sis framebuffer driver complains with a compile-time warning
+if neither the FB_SIS_300 nor FB_SIS_315 symbols are selected:
+
+drivers/video/fbdev/sis/sis_main.c:61:2: warning: #warning Neither CONFIG_FB_SIS_300 nor CONFIG_FB_SIS_315 is se
+
+This is reasonable because it doesn't work in that case, but it's
+also annoying for randconfig builds and is one of the most common
+warnings I'm seeing on ARM now.
+
+This changes the Kconfig logic to prevent the silly configuration,
+by always selecting the FB_SIS_300 variant if the other one is
+not set.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/video/fbdev/Kconfig | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/video/fbdev/Kconfig
++++ b/drivers/video/fbdev/Kconfig
+@@ -1506,6 +1506,7 @@ config FB_SIS
+ select FB_CFB_COPYAREA
+ select FB_CFB_IMAGEBLIT
+ select FB_BOOT_VESA_SUPPORT if FB_SIS = y
++ select FB_SIS_300 if !FB_SIS_315
+ help
+ This is the frame buffer device driver for the SiS 300, 315, 330
+ and 340 series as well as XGI V3XT, V5, V8, Z7 graphics chipsets.
--- /dev/null
+From 24ed78dc2e8b2428eccc70c3162e70d33ab448c4 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Fri, 20 Nov 2015 22:48:36 +0100
+Subject: fbdev: sm712fb: avoid unused function warnings
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit 24ed78dc2e8b2428eccc70c3162e70d33ab448c4 upstream.
+
+The sm712fb framebuffer driver encloses the power-management
+functions in #ifdef CONFIG_PM, but the smtcfb_pci_suspend/resume
+functions are only really used when CONFIG_PM_SLEEP is also
+set, as a frequent gcc warning shows:
+
+fbdev/sm712fb.c:1549:12: warning: 'smtcfb_pci_suspend' defined but not used
+fbdev/sm712fb.c:1572:12: warning: 'smtcfb_pci_resume' defined but not used
+
+The driver also avoids using the SIMPLE_DEV_PM_OPS macro when
+CONFIG_PM is unset, which is redundant.
+
+This changes the driver to remove the #ifdef and instead mark
+the functions as __maybe_unused, which is a nicer anyway, as it
+provides build testing for all the code in all configurations
+and is harder to get wrong.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/video/fbdev/sm712fb.c | 16 +++-------------
+ 1 file changed, 3 insertions(+), 13 deletions(-)
+
+--- a/drivers/video/fbdev/sm712fb.c
++++ b/drivers/video/fbdev/sm712fb.c
+@@ -28,9 +28,7 @@
+ #include <linux/console.h>
+ #include <linux/screen_info.h>
+
+-#ifdef CONFIG_PM
+ #include <linux/pm.h>
+-#endif
+
+ #include "sm712.h"
+
+@@ -1545,8 +1543,7 @@ static void smtcfb_pci_remove(struct pci
+ pci_disable_device(pdev);
+ }
+
+-#ifdef CONFIG_PM
+-static int smtcfb_pci_suspend(struct device *device)
++static int __maybe_unused smtcfb_pci_suspend(struct device *device)
+ {
+ struct pci_dev *pdev = to_pci_dev(device);
+ struct smtcfb_info *sfb;
+@@ -1569,7 +1566,7 @@ static int smtcfb_pci_suspend(struct dev
+ return 0;
+ }
+
+-static int smtcfb_pci_resume(struct device *device)
++static int __maybe_unused smtcfb_pci_resume(struct device *device)
+ {
+ struct pci_dev *pdev = to_pci_dev(device);
+ struct smtcfb_info *sfb;
+@@ -1610,20 +1607,13 @@ static int smtcfb_pci_resume(struct devi
+ }
+
+ static SIMPLE_DEV_PM_OPS(sm7xx_pm_ops, smtcfb_pci_suspend, smtcfb_pci_resume);
+-#define SM7XX_PM_OPS (&sm7xx_pm_ops)
+-
+-#else /* !CONFIG_PM */
+-
+-#define SM7XX_PM_OPS NULL
+-
+-#endif /* !CONFIG_PM */
+
+ static struct pci_driver smtcfb_driver = {
+ .name = "smtcfb",
+ .id_table = smtcfb_pci_table,
+ .probe = smtcfb_pci_probe,
+ .remove = smtcfb_pci_remove,
+- .driver.pm = SM7XX_PM_OPS,
++ .driver.pm = &sm7xx_pm_ops,
+ };
+
+ static int __init sm712fb_init(void)
--- /dev/null
+From 2f44e29cef006a4b0a4ecf7d4c5aac7d0fbb505c Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Tue, 14 Feb 2017 22:53:12 +0100
+Subject: genirq/msi: Add stubs for get_cached_msi_msg/pci_write_msi_msg
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit 2f44e29cef006a4b0a4ecf7d4c5aac7d0fbb505c upstream.
+
+A bug fix to the MSIx handling in vfio added references to functions
+that may not be defined if MSI is disabled in the kernel, resulting in
+this link error:
+
+drivers/built-in.o: In function `vfio_msi_set_vector_signal':
+:(.text+0x450808): undefined reference to `get_cached_msi_msg'
+:(.text+0x45080c): undefined reference to `write_msi_msg'
+
+As suggested by Alex Williamson, add stub implementations for
+get_cached_msi_msg() and pci_write_msi_msg().
+
+In case this bugfix gets backported, please note that the #ifdef
+has changed over time, originally both functions were implemented
+in drivers/pci/msi.c and controlled by CONFIG_PCI_MSI, while nowadays
+get_cached_msi_msg() is part of the generic MSI support and can be
+used without PCI.
+
+Fixes: b8f02af096b1 ("vfio/pci: Restore MSIx message prior to enabling")
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Cc: Marc Zyngier <marc.zyngier@arm.com>
+Cc: Alex Williamson <alex.williamson@redhat.com>
+Cc: Bjorn Helgaas <bhelgaas@google.com>
+Cc: Bart Van Assche <bart.vanassche@sandisk.com>
+Link: http://lkml.kernel.org/r/1413190208.4202.34.camel@ul30vt.home
+Link: http://lkml.kernel.org/r/20170214215343.3307861-1-arnd@arndb.de
+Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ include/linux/msi.h | 11 ++++++++++-
+ 1 file changed, 10 insertions(+), 1 deletion(-)
+
+--- a/include/linux/msi.h
++++ b/include/linux/msi.h
+@@ -17,7 +17,13 @@ struct msi_desc;
+ struct pci_dev;
+ struct platform_msi_priv_data;
+ void __get_cached_msi_msg(struct msi_desc *entry, struct msi_msg *msg);
++#ifdef CONFIG_GENERIC_MSI_IRQ
+ void get_cached_msi_msg(unsigned int irq, struct msi_msg *msg);
++#else
++static inline void get_cached_msi_msg(unsigned int irq, struct msi_msg *msg)
++{
++}
++#endif
+
+ typedef void (*irq_write_msi_msg_t)(struct msi_desc *desc,
+ struct msi_msg *msg);
+@@ -105,18 +111,21 @@ struct msi_desc {
+
+ struct pci_dev *msi_desc_to_pci_dev(struct msi_desc *desc);
+ void *msi_desc_to_pci_sysdata(struct msi_desc *desc);
++void pci_write_msi_msg(unsigned int irq, struct msi_msg *msg);
+ #else /* CONFIG_PCI_MSI */
+ static inline void *msi_desc_to_pci_sysdata(struct msi_desc *desc)
+ {
+ return NULL;
+ }
++static inline void pci_write_msi_msg(unsigned int irq, struct msi_msg *msg)
++{
++}
+ #endif /* CONFIG_PCI_MSI */
+
+ struct msi_desc *alloc_msi_entry(struct device *dev);
+ void free_msi_entry(struct msi_desc *entry);
+ void __pci_read_msi_msg(struct msi_desc *entry, struct msi_msg *msg);
+ void __pci_write_msi_msg(struct msi_desc *entry, struct msi_msg *msg);
+-void pci_write_msi_msg(unsigned int irq, struct msi_msg *msg);
+
+ u32 __pci_msix_desc_mask_irq(struct msi_desc *desc, u32 flag);
+ u32 __pci_msi_desc_mask_irq(struct msi_desc *desc, u32 mask, u32 flag);
--- /dev/null
+From foo@baz Fri Feb 23 17:12:49 CET 2018
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Tue, 20 Feb 2018 12:55:01 +0100
+Subject: genksyms: Fix segfault with invalid declarations
+To: stable@vger.kernel.org
+Cc: Greg KH <gregkh@linuxfoundation.org>, linux-kernel@vger.kernel.org, Michal Marek <mmarek@suse.com>, Arnd Bergmann <arnd@arndb.de>
+Message-ID: <20180220115527.1806578-15-arnd@arndb.de>
+
+From: Michal Marek <mmarek@suse.com>
+
+commit d920f7c6628c63a390009c237fb80a203c2e400a upstream.
+
+Do not try to recover too early and segfault when parsing invalid
+declarations such as
+
+echo 'int (int);' | scripts/genksyms/genksyms
+echo 'int a, (int);' | scripts/genksyms/genksyms
+echo 'extern void *__inline_memcpy((void *), (const void *), (__kernel_size_t));' | scripts/genksyms/genksyms
+
+The last one was a real-life bug with
+include/asm-generic/asm-prototypes.h on x86_64.
+
+Reported-and-tested-by: Borislav Petkov <bp@alien8.de>
+Signed-off-by: Michal Marek <mmarek@suse.com>
+[arnd: rebase to 4.4, regenerate parse.tab.{c,h}]
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ scripts/genksyms/parse.tab.c_shipped | 1682 ++++++++++++++++-------------------
+ scripts/genksyms/parse.tab.h_shipped | 133 +-
+ scripts/genksyms/parse.y | 2
+ 3 files changed, 853 insertions(+), 964 deletions(-)
+
+--- a/scripts/genksyms/parse.tab.c_shipped
++++ b/scripts/genksyms/parse.tab.c_shipped
+@@ -1,19 +1,19 @@
+-/* A Bison parser, made by GNU Bison 2.7. */
++/* A Bison parser, made by GNU Bison 3.0.4. */
+
+ /* Bison implementation for Yacc-like parsers in C
+-
+- Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc.
+-
++
++ Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
++
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+-
++
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+-
++
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+@@ -26,7 +26,7 @@
+ special exception, which will cause the skeleton and the resulting
+ Bison output files to be licensed under the GNU General Public
+ License without this special exception.
+-
++
+ This special exception was added by the Free Software Foundation in
+ version 2.2 of Bison. */
+
+@@ -44,7 +44,7 @@
+ #define YYBISON 1
+
+ /* Bison version. */
+-#define YYBISON_VERSION "2.7"
++#define YYBISON_VERSION "3.0.4"
+
+ /* Skeleton name. */
+ #define YYSKELETON_NAME "yacc.c"
+@@ -62,7 +62,7 @@
+
+
+ /* Copy the first part of user declarations. */
+-
++#line 24 "parse.y" /* yacc.c:339 */
+
+
+ #include <assert.h>
+@@ -113,13 +113,13 @@ static void record_compound(struct strin
+ }
+
+
++#line 117 "parse.tab.c" /* yacc.c:339 */
+
+-
+-# ifndef YY_NULL
++# ifndef YY_NULLPTR
+ # if defined __cplusplus && 201103L <= __cplusplus
+-# define YY_NULL nullptr
++# define YY_NULLPTR nullptr
+ # else
+-# define YY_NULL 0
++# define YY_NULLPTR 0
+ # endif
+ # endif
+
+@@ -131,8 +131,11 @@ static void record_compound(struct strin
+ # define YYERROR_VERBOSE 0
+ #endif
+
+-
+-/* Enabling traces. */
++/* In a future release of Bison, this section will be replaced
++ by #include "parse.tab.h". */
++#ifndef YY_YY_PARSE_TAB_H_INCLUDED
++# define YY_YY_PARSE_TAB_H_INCLUDED
++/* Debug traces. */
+ #ifndef YYDEBUG
+ # define YYDEBUG 1
+ #endif
+@@ -140,86 +143,73 @@ static void record_compound(struct strin
+ extern int yydebug;
+ #endif
+
+-/* Tokens. */
++/* Token type. */
+ #ifndef YYTOKENTYPE
+ # define YYTOKENTYPE
+- /* Put the tokens into the symbol table, so that GDB and other debuggers
+- know about them. */
+- enum yytokentype {
+- ASM_KEYW = 258,
+- ATTRIBUTE_KEYW = 259,
+- AUTO_KEYW = 260,
+- BOOL_KEYW = 261,
+- CHAR_KEYW = 262,
+- CONST_KEYW = 263,
+- DOUBLE_KEYW = 264,
+- ENUM_KEYW = 265,
+- EXTERN_KEYW = 266,
+- EXTENSION_KEYW = 267,
+- FLOAT_KEYW = 268,
+- INLINE_KEYW = 269,
+- INT_KEYW = 270,
+- LONG_KEYW = 271,
+- REGISTER_KEYW = 272,
+- RESTRICT_KEYW = 273,
+- SHORT_KEYW = 274,
+- SIGNED_KEYW = 275,
+- STATIC_KEYW = 276,
+- STRUCT_KEYW = 277,
+- TYPEDEF_KEYW = 278,
+- UNION_KEYW = 279,
+- UNSIGNED_KEYW = 280,
+- VOID_KEYW = 281,
+- VOLATILE_KEYW = 282,
+- TYPEOF_KEYW = 283,
+- EXPORT_SYMBOL_KEYW = 284,
+- ASM_PHRASE = 285,
+- ATTRIBUTE_PHRASE = 286,
+- TYPEOF_PHRASE = 287,
+- BRACE_PHRASE = 288,
+- BRACKET_PHRASE = 289,
+- EXPRESSION_PHRASE = 290,
+- CHAR = 291,
+- DOTS = 292,
+- IDENT = 293,
+- INT = 294,
+- REAL = 295,
+- STRING = 296,
+- TYPE = 297,
+- OTHER = 298,
+- FILENAME = 299
+- };
++ enum yytokentype
++ {
++ ASM_KEYW = 258,
++ ATTRIBUTE_KEYW = 259,
++ AUTO_KEYW = 260,
++ BOOL_KEYW = 261,
++ CHAR_KEYW = 262,
++ CONST_KEYW = 263,
++ DOUBLE_KEYW = 264,
++ ENUM_KEYW = 265,
++ EXTERN_KEYW = 266,
++ EXTENSION_KEYW = 267,
++ FLOAT_KEYW = 268,
++ INLINE_KEYW = 269,
++ INT_KEYW = 270,
++ LONG_KEYW = 271,
++ REGISTER_KEYW = 272,
++ RESTRICT_KEYW = 273,
++ SHORT_KEYW = 274,
++ SIGNED_KEYW = 275,
++ STATIC_KEYW = 276,
++ STRUCT_KEYW = 277,
++ TYPEDEF_KEYW = 278,
++ UNION_KEYW = 279,
++ UNSIGNED_KEYW = 280,
++ VOID_KEYW = 281,
++ VOLATILE_KEYW = 282,
++ TYPEOF_KEYW = 283,
++ EXPORT_SYMBOL_KEYW = 284,
++ ASM_PHRASE = 285,
++ ATTRIBUTE_PHRASE = 286,
++ TYPEOF_PHRASE = 287,
++ BRACE_PHRASE = 288,
++ BRACKET_PHRASE = 289,
++ EXPRESSION_PHRASE = 290,
++ CHAR = 291,
++ DOTS = 292,
++ IDENT = 293,
++ INT = 294,
++ REAL = 295,
++ STRING = 296,
++ TYPE = 297,
++ OTHER = 298,
++ FILENAME = 299
++ };
+ #endif
+
+-
++/* Value type. */
+ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
+ typedef int YYSTYPE;
+ # define YYSTYPE_IS_TRIVIAL 1
+-# define yystype YYSTYPE /* obsolescent; will be withdrawn */
+ # define YYSTYPE_IS_DECLARED 1
+ #endif
+
++
+ extern YYSTYPE yylval;
+
+-#ifdef YYPARSE_PARAM
+-#if defined __STDC__ || defined __cplusplus
+-int yyparse (void *YYPARSE_PARAM);
+-#else
+-int yyparse ();
+-#endif
+-#else /* ! YYPARSE_PARAM */
+-#if defined __STDC__ || defined __cplusplus
+ int yyparse (void);
+-#else
+-int yyparse ();
+-#endif
+-#endif /* ! YYPARSE_PARAM */
+-
+
++#endif /* !YY_YY_PARSE_TAB_H_INCLUDED */
+
+ /* Copy the second part of user declarations. */
+
+-
++#line 213 "parse.tab.c" /* yacc.c:358 */
+
+ #ifdef short
+ # undef short
+@@ -233,11 +223,8 @@ typedef unsigned char yytype_uint8;
+
+ #ifdef YYTYPE_INT8
+ typedef YYTYPE_INT8 yytype_int8;
+-#elif (defined __STDC__ || defined __C99__FUNC__ \
+- || defined __cplusplus || defined _MSC_VER)
+-typedef signed char yytype_int8;
+ #else
+-typedef short int yytype_int8;
++typedef signed char yytype_int8;
+ #endif
+
+ #ifdef YYTYPE_UINT16
+@@ -257,8 +244,7 @@ typedef short int yytype_int16;
+ # define YYSIZE_T __SIZE_TYPE__
+ # elif defined size_t
+ # define YYSIZE_T size_t
+-# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
+- || defined __cplusplus || defined _MSC_VER)
++# elif ! defined YYSIZE_T
+ # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
+ # define YYSIZE_T size_t
+ # else
+@@ -280,6 +266,33 @@ typedef short int yytype_int16;
+ # endif
+ #endif
+
++#ifndef YY_ATTRIBUTE
++# if (defined __GNUC__ \
++ && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
++ || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
++# define YY_ATTRIBUTE(Spec) __attribute__(Spec)
++# else
++# define YY_ATTRIBUTE(Spec) /* empty */
++# endif
++#endif
++
++#ifndef YY_ATTRIBUTE_PURE
++# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
++#endif
++
++#ifndef YY_ATTRIBUTE_UNUSED
++# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
++#endif
++
++#if !defined _Noreturn \
++ && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
++# if defined _MSC_VER && 1200 <= _MSC_VER
++# define _Noreturn __declspec (noreturn)
++# else
++# define _Noreturn YY_ATTRIBUTE ((__noreturn__))
++# endif
++#endif
++
+ /* Suppress unused-variable warnings by "using" E. */
+ #if ! defined lint || defined __GNUC__
+ # define YYUSE(E) ((void) (E))
+@@ -287,24 +300,26 @@ typedef short int yytype_int16;
+ # define YYUSE(E) /* empty */
+ #endif
+
+-/* Identity function, used to suppress warnings about constant conditions. */
+-#ifndef lint
+-# define YYID(N) (N)
+-#else
+-#if (defined __STDC__ || defined __C99__FUNC__ \
+- || defined __cplusplus || defined _MSC_VER)
+-static int
+-YYID (int yyi)
++#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
++/* Suppress an incorrect diagnostic about yylval being uninitialized. */
++# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
++ _Pragma ("GCC diagnostic push") \
++ _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
++ _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
++# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
++ _Pragma ("GCC diagnostic pop")
+ #else
+-static int
+-YYID (yyi)
+- int yyi;
++# define YY_INITIAL_VALUE(Value) Value
+ #endif
+-{
+- return yyi;
+-}
++#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
++# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
++# define YY_IGNORE_MAYBE_UNINITIALIZED_END
++#endif
++#ifndef YY_INITIAL_VALUE
++# define YY_INITIAL_VALUE(Value) /* Nothing. */
+ #endif
+
++
+ #if ! defined yyoverflow || YYERROR_VERBOSE
+
+ /* The parser invokes alloca or malloc; define the necessary symbols. */
+@@ -322,8 +337,7 @@ YYID (yyi)
+ # define alloca _alloca
+ # else
+ # define YYSTACK_ALLOC alloca
+-# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
+- || defined __cplusplus || defined _MSC_VER)
++# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
+ # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
+ /* Use EXIT_SUCCESS as a witness for stdlib.h. */
+ # ifndef EXIT_SUCCESS
+@@ -335,8 +349,8 @@ YYID (yyi)
+ # endif
+
+ # ifdef YYSTACK_ALLOC
+- /* Pacify GCC's `empty if-body' warning. */
+-# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
++ /* Pacify GCC's 'empty if-body' warning. */
++# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
+ # ifndef YYSTACK_ALLOC_MAXIMUM
+ /* The OS might guarantee only one guard page at the bottom of the stack,
+ and a page size can be as small as 4096 bytes. So we cannot safely
+@@ -352,7 +366,7 @@ YYID (yyi)
+ # endif
+ # if (defined __cplusplus && ! defined EXIT_SUCCESS \
+ && ! ((defined YYMALLOC || defined malloc) \
+- && (defined YYFREE || defined free)))
++ && (defined YYFREE || defined free)))
+ # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
+ # ifndef EXIT_SUCCESS
+ # define EXIT_SUCCESS 0
+@@ -360,15 +374,13 @@ YYID (yyi)
+ # endif
+ # ifndef YYMALLOC
+ # define YYMALLOC malloc
+-# if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
+- || defined __cplusplus || defined _MSC_VER)
++# if ! defined malloc && ! defined EXIT_SUCCESS
+ void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
+ # endif
+ # endif
+ # ifndef YYFREE
+ # define YYFREE free
+-# if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
+- || defined __cplusplus || defined _MSC_VER)
++# if ! defined free && ! defined EXIT_SUCCESS
+ void free (void *); /* INFRINGES ON USER NAME SPACE */
+ # endif
+ # endif
+@@ -378,7 +390,7 @@ void free (void *); /* INFRINGES ON USER
+
+ #if (! defined yyoverflow \
+ && (! defined __cplusplus \
+- || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
++ || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
+
+ /* A type that is properly aligned for any stack member. */
+ union yyalloc
+@@ -403,16 +415,16 @@ union yyalloc
+ elements in the stack, and YYPTR gives the new location of the
+ stack. Advance YYPTR to a properly aligned location for the next
+ stack. */
+-# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
+- do \
+- { \
+- YYSIZE_T yynewbytes; \
+- YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
+- Stack = &yyptr->Stack_alloc; \
+- yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
+- yyptr += yynewbytes / sizeof (*yyptr); \
+- } \
+- while (YYID (0))
++# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
++ do \
++ { \
++ YYSIZE_T yynewbytes; \
++ YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
++ Stack = &yyptr->Stack_alloc; \
++ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
++ yyptr += yynewbytes / sizeof (*yyptr); \
++ } \
++ while (0)
+
+ #endif
+
+@@ -431,7 +443,7 @@ union yyalloc
+ for (yyi = 0; yyi < (Count); yyi++) \
+ (Dst)[yyi] = (Src)[yyi]; \
+ } \
+- while (YYID (0))
++ while (0)
+ # endif
+ # endif
+ #endif /* !YYCOPY_NEEDED */
+@@ -439,25 +451,27 @@ union yyalloc
+ /* YYFINAL -- State number of the termination state. */
+ #define YYFINAL 4
+ /* YYLAST -- Last index in YYTABLE. */
+-#define YYLAST 515
++#define YYLAST 513
+
+ /* YYNTOKENS -- Number of terminals. */
+ #define YYNTOKENS 54
+ /* YYNNTS -- Number of nonterminals. */
+ #define YYNNTS 49
+ /* YYNRULES -- Number of rules. */
+-#define YYNRULES 133
+-/* YYNRULES -- Number of states. */
+-#define YYNSTATES 188
++#define YYNRULES 132
++/* YYNSTATES -- Number of states. */
++#define YYNSTATES 186
+
+-/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
++/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
++ by yylex, with out-of-bounds checking. */
+ #define YYUNDEFTOK 2
+ #define YYMAXUTOK 299
+
+-#define YYTRANSLATE(YYX) \
++#define YYTRANSLATE(YYX) \
+ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
+
+-/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
++/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
++ as returned by yylex, without out-of-bounds checking. */
+ static const yytype_uint8 yytranslate[] =
+ {
+ 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+@@ -493,69 +507,7 @@ static const yytype_uint8 yytranslate[]
+ };
+
+ #if YYDEBUG
+-/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
+- YYRHS. */
+-static const yytype_uint16 yyprhs[] =
+-{
+- 0, 0, 3, 5, 8, 9, 12, 13, 18, 19,
+- 23, 25, 27, 29, 31, 34, 37, 41, 42, 44,
+- 46, 50, 55, 56, 58, 60, 63, 65, 67, 69,
+- 71, 73, 75, 77, 79, 81, 86, 88, 91, 94,
+- 97, 101, 105, 109, 112, 115, 118, 120, 122, 124,
+- 126, 128, 130, 132, 134, 136, 138, 140, 143, 144,
+- 146, 148, 151, 153, 155, 157, 159, 162, 164, 166,
+- 168, 173, 178, 181, 185, 189, 192, 194, 196, 198,
+- 203, 208, 211, 215, 219, 222, 224, 228, 229, 231,
+- 233, 237, 240, 243, 245, 246, 248, 250, 255, 260,
+- 263, 267, 271, 275, 276, 278, 281, 285, 289, 290,
+- 292, 294, 297, 301, 304, 305, 307, 309, 313, 316,
+- 319, 321, 324, 325, 328, 332, 337, 339, 343, 345,
+- 349, 352, 353, 355
+-};
+-
+-/* YYRHS -- A `-1'-separated list of the rules' RHS. */
+-static const yytype_int8 yyrhs[] =
+-{
+- 55, 0, -1, 56, -1, 55, 56, -1, -1, 57,
+- 58, -1, -1, 12, 23, 59, 61, -1, -1, 23,
+- 60, 61, -1, 61, -1, 85, -1, 100, -1, 102,
+- -1, 1, 45, -1, 1, 46, -1, 65, 62, 45,
+- -1, -1, 63, -1, 64, -1, 63, 47, 64, -1,
+- 75, 101, 96, 86, -1, -1, 66, -1, 67, -1,
+- 66, 67, -1, 68, -1, 69, -1, 5, -1, 17,
+- -1, 21, -1, 11, -1, 14, -1, 70, -1, 74,
+- -1, 28, 48, 82, 49, -1, 32, -1, 22, 38,
+- -1, 24, 38, -1, 10, 38, -1, 22, 38, 88,
+- -1, 24, 38, 88, -1, 10, 38, 97, -1, 10,
+- 97, -1, 22, 88, -1, 24, 88, -1, 7, -1,
+- 19, -1, 15, -1, 16, -1, 20, -1, 25, -1,
+- 13, -1, 9, -1, 26, -1, 6, -1, 42, -1,
+- 50, 72, -1, -1, 73, -1, 74, -1, 73, 74,
+- -1, 8, -1, 27, -1, 31, -1, 18, -1, 71,
+- 75, -1, 76, -1, 38, -1, 42, -1, 76, 48,
+- 79, 49, -1, 76, 48, 1, 49, -1, 76, 34,
+- -1, 48, 75, 49, -1, 48, 1, 49, -1, 71,
+- 77, -1, 78, -1, 38, -1, 42, -1, 78, 48,
+- 79, 49, -1, 78, 48, 1, 49, -1, 78, 34,
+- -1, 48, 77, 49, -1, 48, 1, 49, -1, 80,
+- 37, -1, 80, -1, 81, 47, 37, -1, -1, 81,
+- -1, 82, -1, 81, 47, 82, -1, 66, 83, -1,
+- 71, 83, -1, 84, -1, -1, 38, -1, 42, -1,
+- 84, 48, 79, 49, -1, 84, 48, 1, 49, -1,
+- 84, 34, -1, 48, 83, 49, -1, 48, 1, 49,
+- -1, 65, 75, 33, -1, -1, 87, -1, 51, 35,
+- -1, 52, 89, 46, -1, 52, 1, 46, -1, -1,
+- 90, -1, 91, -1, 90, 91, -1, 65, 92, 45,
+- -1, 1, 45, -1, -1, 93, -1, 94, -1, 93,
+- 47, 94, -1, 77, 96, -1, 38, 95, -1, 95,
+- -1, 53, 35, -1, -1, 96, 31, -1, 52, 98,
+- 46, -1, 52, 98, 47, 46, -1, 99, -1, 98,
+- 47, 99, -1, 38, -1, 38, 51, 35, -1, 30,
+- 45, -1, -1, 30, -1, 29, 48, 38, 49, 45,
+- -1
+-};
+-
+-/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
++ /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
+ static const yytype_uint16 yyrline[] =
+ {
+ 0, 124, 124, 125, 129, 129, 135, 135, 137, 137,
+@@ -565,13 +517,13 @@ static const yytype_uint16 yyrline[] =
+ 237, 239, 241, 246, 249, 250, 254, 255, 256, 257,
+ 258, 259, 260, 261, 262, 263, 264, 268, 273, 274,
+ 278, 279, 283, 283, 283, 284, 292, 293, 297, 306,
+- 315, 317, 319, 321, 323, 330, 331, 335, 336, 337,
+- 339, 341, 343, 345, 350, 351, 352, 356, 357, 361,
+- 362, 367, 372, 374, 378, 379, 387, 391, 393, 395,
+- 397, 399, 404, 413, 414, 419, 424, 425, 429, 430,
+- 434, 435, 439, 441, 446, 447, 451, 452, 456, 457,
+- 458, 462, 466, 467, 471, 472, 476, 477, 480, 485,
+- 493, 497, 498, 502
++ 315, 317, 319, 321, 328, 329, 333, 334, 335, 337,
++ 339, 341, 343, 348, 349, 350, 354, 355, 359, 360,
++ 365, 370, 372, 376, 377, 385, 389, 391, 393, 395,
++ 397, 402, 411, 412, 417, 422, 423, 427, 428, 432,
++ 433, 437, 439, 444, 445, 449, 450, 454, 455, 456,
++ 460, 464, 465, 469, 470, 474, 475, 478, 483, 491,
++ 495, 496, 500
+ };
+ #endif
+
+@@ -606,13 +558,13 @@ static const char *const yytname[] =
+ "member_declarator_list_opt", "member_declarator_list",
+ "member_declarator", "member_bitfield_declarator", "attribute_opt",
+ "enum_body", "enumerator_list", "enumerator", "asm_definition",
+- "asm_phrase_opt", "export_definition", YY_NULL
++ "asm_phrase_opt", "export_definition", YY_NULLPTR
+ };
+ #endif
+
+ # ifdef YYPRINT
+-/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
+- token YYLEX-NUM. */
++/* YYTOKNUM[NUM] -- (External) token number corresponding to the
++ (internal) symbol number NUM (which must be that of a token). */
+ static const yytype_uint16 yytoknum[] =
+ {
+ 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
+@@ -624,47 +576,44 @@ static const yytype_uint16 yytoknum[] =
+ };
+ # endif
+
+-/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
+-static const yytype_uint8 yyr1[] =
+-{
+- 0, 54, 55, 55, 57, 56, 59, 58, 60, 58,
+- 58, 58, 58, 58, 58, 58, 61, 62, 62, 63,
+- 63, 64, 65, 65, 66, 66, 67, 67, 68, 68,
+- 68, 68, 68, 69, 69, 69, 69, 69, 69, 69,
+- 69, 69, 69, 69, 69, 69, 70, 70, 70, 70,
+- 70, 70, 70, 70, 70, 70, 70, 71, 72, 72,
+- 73, 73, 74, 74, 74, 74, 75, 75, 76, 76,
+- 76, 76, 76, 76, 76, 77, 77, 78, 78, 78,
+- 78, 78, 78, 78, 79, 79, 79, 80, 80, 81,
+- 81, 82, 83, 83, 84, 84, 84, 84, 84, 84,
+- 84, 84, 85, 86, 86, 87, 88, 88, 89, 89,
+- 90, 90, 91, 91, 92, 92, 93, 93, 94, 94,
+- 94, 95, 96, 96, 97, 97, 98, 98, 99, 99,
+- 100, 101, 101, 102
+-};
++#define YYPACT_NINF -135
+
+-/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
+-static const yytype_uint8 yyr2[] =
++#define yypact_value_is_default(Yystate) \
++ (!!((Yystate) == (-135)))
++
++#define YYTABLE_NINF -109
++
++#define yytable_value_is_error(Yytable_value) \
++ 0
++
++ /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
++ STATE-NUM. */
++static const yytype_int16 yypact[] =
+ {
+- 0, 2, 1, 2, 0, 2, 0, 4, 0, 3,
+- 1, 1, 1, 1, 2, 2, 3, 0, 1, 1,
+- 3, 4, 0, 1, 1, 2, 1, 1, 1, 1,
+- 1, 1, 1, 1, 1, 4, 1, 2, 2, 2,
+- 3, 3, 3, 2, 2, 2, 1, 1, 1, 1,
+- 1, 1, 1, 1, 1, 1, 1, 2, 0, 1,
+- 1, 2, 1, 1, 1, 1, 2, 1, 1, 1,
+- 4, 4, 2, 3, 3, 2, 1, 1, 1, 4,
+- 4, 2, 3, 3, 2, 1, 3, 0, 1, 1,
+- 3, 2, 2, 1, 0, 1, 1, 4, 4, 2,
+- 3, 3, 3, 0, 1, 2, 3, 3, 0, 1,
+- 1, 2, 3, 2, 0, 1, 1, 3, 2, 2,
+- 1, 2, 0, 2, 3, 4, 1, 3, 1, 3,
+- 2, 0, 1, 5
++ -135, 38, -135, 206, -135, -135, 22, -135, -135, -135,
++ -135, -135, -24, -135, 20, -135, -135, -135, -135, -135,
++ -135, -135, -135, -135, -23, -135, 6, -135, -135, -135,
++ -2, 15, 24, -135, -135, -135, -135, -135, 41, 471,
++ -135, -135, -135, -135, -135, -135, -135, -135, -135, -135,
++ 13, 36, -135, -135, 35, 106, -135, 471, 35, -135,
++ 471, 44, -135, -135, -135, 41, 39, 45, 48, -135,
++ 41, -10, 25, -135, -135, 47, 34, -135, 471, -135,
++ 26, -26, 53, 156, -135, -135, 41, -135, 387, 52,
++ 57, 59, -135, 39, -135, -135, 41, -135, -135, -135,
++ -135, -135, 252, 67, -135, -21, -135, -135, -135, 51,
++ -135, 12, 83, 46, -135, 27, 84, 88, -135, -135,
++ -135, 91, -135, 109, -135, -135, 3, 55, -135, 30,
++ -135, 95, -135, -135, -135, -20, 92, 93, 108, 96,
++ -135, -135, -135, -135, -135, 97, -135, 98, -135, -135,
++ 118, -135, 297, -135, -26, 101, -135, 104, -135, -135,
++ 342, -135, -135, 120, -135, -135, -135, -135, -135, 433,
++ -135, -135, 111, 119, -135, -135, -135, 130, 136, -135,
++ -135, -135, -135, -135, -135, -135
+ };
+
+-/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
+- Performed when YYTABLE doesn't specify something else to do. Zero
+- means the default is an error. */
++ /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
++ Performed when YYTABLE does not specify something else to do. Zero
++ means the default is an error. */
+ static const yytype_uint8 yydefact[] =
+ {
+ 4, 4, 2, 0, 1, 3, 0, 28, 55, 46,
+@@ -673,191 +622,158 @@ static const yytype_uint8 yydefact[] =
+ 0, 0, 0, 64, 36, 56, 5, 10, 17, 23,
+ 24, 26, 27, 33, 34, 11, 12, 13, 14, 15,
+ 39, 0, 43, 6, 37, 0, 44, 22, 38, 45,
+- 0, 0, 130, 68, 69, 0, 58, 0, 18, 19,
+- 0, 131, 67, 25, 42, 128, 0, 126, 22, 40,
+- 0, 114, 0, 0, 110, 9, 17, 41, 94, 0,
+- 0, 0, 0, 57, 59, 60, 16, 0, 66, 132,
+- 102, 122, 72, 0, 0, 124, 0, 7, 113, 107,
+- 77, 78, 0, 0, 0, 122, 76, 0, 115, 116,
+- 120, 106, 0, 111, 131, 95, 56, 0, 94, 91,
+- 93, 35, 0, 74, 73, 61, 20, 103, 0, 0,
+- 85, 88, 89, 129, 125, 127, 119, 0, 77, 0,
+- 121, 75, 118, 81, 0, 112, 0, 0, 96, 0,
+- 92, 99, 0, 133, 123, 0, 21, 104, 71, 70,
+- 84, 0, 83, 82, 0, 0, 117, 101, 100, 0,
+- 0, 105, 86, 90, 80, 79, 98, 97
+-};
+-
+-/* YYDEFGOTO[NTERM-NUM]. */
+-static const yytype_int16 yydefgoto[] =
+-{
+- -1, 1, 2, 3, 36, 78, 57, 37, 67, 68,
+- 69, 81, 39, 40, 41, 42, 43, 70, 93, 94,
+- 44, 124, 72, 115, 116, 139, 140, 141, 142, 129,
+- 130, 45, 166, 167, 56, 82, 83, 84, 117, 118,
+- 119, 120, 137, 52, 76, 77, 46, 101, 47
++ 0, 0, 129, 68, 69, 0, 58, 0, 18, 19,
++ 0, 130, 67, 25, 42, 127, 0, 125, 22, 40,
++ 0, 113, 0, 0, 109, 9, 17, 41, 93, 0,
++ 0, 0, 57, 59, 60, 16, 0, 66, 131, 101,
++ 121, 72, 0, 0, 123, 0, 7, 112, 106, 76,
++ 77, 0, 0, 0, 121, 75, 0, 114, 115, 119,
++ 105, 0, 110, 130, 94, 56, 0, 93, 90, 92,
++ 35, 0, 73, 61, 20, 102, 0, 0, 84, 87,
++ 88, 128, 124, 126, 118, 0, 76, 0, 120, 74,
++ 117, 80, 0, 111, 0, 0, 95, 0, 91, 98,
++ 0, 132, 122, 0, 21, 103, 71, 70, 83, 0,
++ 82, 81, 0, 0, 116, 100, 99, 0, 0, 104,
++ 85, 89, 79, 78, 97, 96
+ };
+
+-/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
+- STATE-NUM. */
+-#define YYPACT_NINF -92
+-static const yytype_int16 yypact[] =
++ /* YYPGOTO[NTERM-NUM]. */
++static const yytype_int16 yypgoto[] =
+ {
+- -92, 19, -92, 208, -92, -92, 39, -92, -92, -92,
+- -92, -92, -27, -92, 23, -92, -92, -92, -92, -92,
+- -92, -92, -92, -92, -22, -92, 9, -92, -92, -92,
+- -6, 16, 25, -92, -92, -92, -92, -92, 31, 473,
+- -92, -92, -92, -92, -92, -92, -92, -92, -92, -92,
+- 49, 37, -92, -92, 51, 108, -92, 473, 51, -92,
+- 473, 59, -92, -92, -92, 12, -3, 60, 57, -92,
+- 31, -7, 24, -92, -92, 55, 42, -92, 473, -92,
+- 46, -21, 61, 158, -92, -92, 31, -92, 389, 71,
+- 82, 88, 89, -92, -3, -92, -92, 31, -92, -92,
+- -92, -92, -92, 254, 73, -92, -24, -92, -92, -92,
+- 90, -92, 17, 75, 45, -92, 32, 96, 95, -92,
+- -92, -92, 99, -92, 115, -92, -92, 3, 48, -92,
+- 34, -92, 102, -92, -92, -92, -92, -11, 100, 103,
+- 111, 104, -92, -92, -92, -92, -92, 106, -92, 113,
+- -92, -92, 126, -92, 299, -92, -21, 121, -92, 132,
+- -92, -92, 344, -92, -92, 125, -92, -92, -92, -92,
+- -92, 435, -92, -92, 138, 139, -92, -92, -92, 142,
+- 143, -92, -92, -92, -92, -92, -92, -92
++ -135, -135, 157, -135, -135, -135, -135, -48, -135, -135,
++ 90, -1, -60, -33, -135, -135, -135, -78, -135, -135,
++ -61, -31, -135, -92, -135, -134, -135, -135, -59, -41,
++ -135, -135, -135, -135, -18, -135, -135, 107, -135, -135,
++ 37, 80, 78, 143, -135, 94, -135, -135, -135
+ };
+
+-/* YYPGOTO[NTERM-NUM]. */
+-static const yytype_int16 yypgoto[] =
++ /* YYDEFGOTO[NTERM-NUM]. */
++static const yytype_int16 yydefgoto[] =
+ {
+- -92, -92, 192, -92, -92, -92, -92, -47, -92, -92,
+- 97, 0, -60, -32, -92, -92, -92, -79, -92, -92,
+- -58, -26, -92, -38, -92, -91, -92, -92, -59, -28,
+- -92, -92, -92, -92, -20, -92, -92, 112, -92, -92,
+- 41, 91, 83, 149, -92, 101, -92, -92, -92
++ -1, 1, 2, 3, 36, 78, 57, 37, 67, 68,
++ 69, 81, 39, 40, 41, 42, 43, 70, 92, 93,
++ 44, 123, 72, 114, 115, 137, 138, 139, 140, 128,
++ 129, 45, 164, 165, 56, 82, 83, 84, 116, 117,
++ 118, 119, 135, 52, 76, 77, 46, 100, 47
+ };
+
+-/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
+- positive, shift that token. If negative, reduce the rule which
+- number is the opposite. If YYTABLE_NINF, syntax error. */
+-#define YYTABLE_NINF -110
++ /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
++ positive, shift that token. If negative, reduce the rule whose
++ number is the opposite. If YYTABLE_NINF, syntax error. */
+ static const yytype_int16 yytable[] =
+ {
+- 88, 89, 114, 38, 157, 10, 59, 73, 95, 128,
+- 85, 50, 71, 91, 75, 20, 54, 110, 147, 4,
+- 164, 111, 144, 99, 29, 51, 100, 112, 33, 66,
+- 55, 107, 113, 114, 79, 114, 135, -94, 87, 92,
+- 165, 125, 60, 88, 98, 158, 53, 58, 128, 128,
+- 63, 127, -94, 66, 64, 148, 73, 86, 102, 111,
+- 65, 55, 66, 175, 61, 112, 153, 66, 161, 63,
+- 62, 180, 103, 64, 149, 75, 151, 114, 86, 65,
+- 154, 66, 162, 148, 48, 49, 125, 111, 105, 106,
+- 158, 108, 109, 112, 88, 66, 127, 90, 66, 159,
+- 160, 51, 88, 55, 97, 96, 104, 121, 143, 80,
+- 150, 88, 183, 7, 8, 9, 10, 11, 12, 13,
+- 131, 15, 16, 17, 18, 19, 20, 21, 22, 23,
+- 24, 132, 26, 27, 28, 29, 30, 133, 134, 33,
+- 34, 155, 156, 113, 108, 99, -22, 163, 170, 168,
+- 35, 171, 169, -22, -108, 172, -22, 164, -22, 122,
+- 181, -22, 173, 7, 8, 9, 10, 11, 12, 13,
+- 177, 15, 16, 17, 18, 19, 20, 21, 22, 23,
+- 24, 178, 26, 27, 28, 29, 30, 184, 185, 33,
+- 34, 186, 187, 5, 136, 123, -22, 176, 152, 74,
+- 35, 146, 0, -22, -109, 0, -22, 145, -22, 6,
+- 0, -22, 0, 7, 8, 9, 10, 11, 12, 13,
+- 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
+- 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
+- 34, 0, 0, 0, 0, 0, -22, 0, 0, 0,
+- 35, 0, 0, -22, 0, 138, -22, 0, -22, 7,
+- 8, 9, 10, 11, 12, 13, 0, 15, 16, 17,
+- 18, 19, 20, 21, 22, 23, 24, 0, 26, 27,
+- 28, 29, 30, 0, 0, 33, 34, 0, 0, 0,
+- 0, -87, 0, 0, 0, 0, 35, 0, 0, 0,
+- 174, 0, 0, -87, 7, 8, 9, 10, 11, 12,
+- 13, 0, 15, 16, 17, 18, 19, 20, 21, 22,
+- 23, 24, 0, 26, 27, 28, 29, 30, 0, 0,
+- 33, 34, 0, 0, 0, 0, -87, 0, 0, 0,
+- 0, 35, 0, 0, 0, 179, 0, 0, -87, 7,
+- 8, 9, 10, 11, 12, 13, 0, 15, 16, 17,
+- 18, 19, 20, 21, 22, 23, 24, 0, 26, 27,
+- 28, 29, 30, 0, 0, 33, 34, 0, 0, 0,
+- 0, -87, 0, 0, 0, 0, 35, 0, 0, 0,
+- 0, 0, 0, -87, 7, 8, 9, 10, 11, 12,
+- 13, 0, 15, 16, 17, 18, 19, 20, 21, 22,
+- 23, 24, 0, 26, 27, 28, 29, 30, 0, 0,
+- 33, 34, 0, 0, 0, 0, 0, 125, 0, 0,
+- 0, 126, 0, 0, 0, 0, 0, 127, 0, 66,
+- 7, 8, 9, 10, 11, 12, 13, 0, 15, 16,
+- 17, 18, 19, 20, 21, 22, 23, 24, 0, 26,
+- 27, 28, 29, 30, 0, 0, 33, 34, 0, 0,
+- 0, 0, 182, 0, 0, 0, 0, 35, 7, 8,
++ 88, 89, 38, 113, 155, 94, 73, 71, 59, 85,
++ 127, 162, 109, 145, 50, 54, 110, 75, 173, 147,
++ 98, 149, 111, 99, 66, 142, 178, 112, 51, 55,
++ 106, 163, 133, 113, 91, 113, 79, -93, 4, 97,
++ 87, 124, 88, 53, 58, 156, 60, 10, 127, 127,
++ 146, 126, -93, 66, 110, 73, 86, 20, 55, 101,
++ 111, 151, 66, 61, 159, 51, 29, 48, 49, 62,
++ 33, 107, 108, 102, 75, 152, 113, 86, 160, 63,
++ 104, 105, 90, 64, 146, 157, 158, 55, 110, 65,
++ 95, 66, 88, 124, 111, 96, 66, 156, 103, 120,
++ 88, 130, 141, 126, 112, 66, 131, 80, 132, 88,
++ 181, 7, 8, 9, 10, 11, 12, 13, 148, 15,
++ 16, 17, 18, 19, 20, 21, 22, 23, 24, 153,
++ 26, 27, 28, 29, 30, 154, 107, 33, 34, 98,
++ 161, 166, 167, 169, -22, 168, 170, 171, 35, 162,
++ 175, -22, -107, 176, -22, 179, -22, 121, 5, -22,
++ 182, 7, 8, 9, 10, 11, 12, 13, 183, 15,
++ 16, 17, 18, 19, 20, 21, 22, 23, 24, 184,
++ 26, 27, 28, 29, 30, 185, 134, 33, 34, 144,
++ 122, 174, 150, 74, -22, 0, 0, 0, 35, 143,
++ 0, -22, -108, 0, -22, 0, -22, 6, 0, -22,
++ 0, 7, 8, 9, 10, 11, 12, 13, 14, 15,
++ 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
++ 26, 27, 28, 29, 30, 31, 32, 33, 34, 0,
++ 0, 0, 0, 0, -22, 0, 0, 0, 35, 0,
++ 0, -22, 0, 136, -22, 0, -22, 7, 8, 9,
++ 10, 11, 12, 13, 0, 15, 16, 17, 18, 19,
++ 20, 21, 22, 23, 24, 0, 26, 27, 28, 29,
++ 30, 0, 0, 33, 34, 0, 0, 0, 0, -86,
++ 0, 0, 0, 0, 35, 0, 0, 0, 172, 0,
++ 0, -86, 7, 8, 9, 10, 11, 12, 13, 0,
++ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
++ 0, 26, 27, 28, 29, 30, 0, 0, 33, 34,
++ 0, 0, 0, 0, -86, 0, 0, 0, 0, 35,
++ 0, 0, 0, 177, 0, 0, -86, 7, 8, 9,
++ 10, 11, 12, 13, 0, 15, 16, 17, 18, 19,
++ 20, 21, 22, 23, 24, 0, 26, 27, 28, 29,
++ 30, 0, 0, 33, 34, 0, 0, 0, 0, -86,
++ 0, 0, 0, 0, 35, 0, 0, 0, 0, 0,
++ 0, -86, 7, 8, 9, 10, 11, 12, 13, 0,
++ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
++ 0, 26, 27, 28, 29, 30, 0, 0, 33, 34,
++ 0, 0, 0, 0, 0, 124, 0, 0, 0, 125,
++ 0, 0, 0, 0, 0, 126, 0, 66, 7, 8,
+ 9, 10, 11, 12, 13, 0, 15, 16, 17, 18,
+ 19, 20, 21, 22, 23, 24, 0, 26, 27, 28,
+ 29, 30, 0, 0, 33, 34, 0, 0, 0, 0,
+- 0, 0, 0, 0, 0, 35
++ 180, 0, 0, 0, 0, 35, 7, 8, 9, 10,
++ 11, 12, 13, 0, 15, 16, 17, 18, 19, 20,
++ 21, 22, 23, 24, 0, 26, 27, 28, 29, 30,
++ 0, 0, 33, 34, 0, 0, 0, 0, 0, 0,
++ 0, 0, 0, 35
+ };
+
+-#define yypact_value_is_default(Yystate) \
+- (!!((Yystate) == (-92)))
+-
+-#define yytable_value_is_error(Yytable_value) \
+- YYID (0)
+-
+ static const yytype_int16 yycheck[] =
+ {
+- 60, 60, 81, 3, 1, 8, 26, 39, 66, 88,
+- 57, 38, 38, 1, 38, 18, 38, 38, 1, 0,
+- 31, 42, 46, 30, 27, 52, 33, 48, 31, 50,
+- 52, 78, 53, 112, 54, 114, 94, 34, 58, 65,
+- 51, 38, 48, 103, 70, 42, 23, 38, 127, 128,
+- 38, 48, 49, 50, 42, 38, 88, 57, 34, 42,
+- 48, 52, 50, 154, 48, 48, 34, 50, 34, 38,
+- 45, 162, 48, 42, 112, 38, 114, 156, 78, 48,
+- 48, 50, 48, 38, 45, 46, 38, 42, 46, 47,
+- 42, 45, 46, 48, 154, 50, 48, 38, 50, 127,
+- 128, 52, 162, 52, 47, 45, 51, 46, 35, 1,
+- 35, 171, 171, 5, 6, 7, 8, 9, 10, 11,
+- 49, 13, 14, 15, 16, 17, 18, 19, 20, 21,
+- 22, 49, 24, 25, 26, 27, 28, 49, 49, 31,
+- 32, 45, 47, 53, 45, 30, 38, 45, 37, 49,
+- 42, 47, 49, 45, 46, 49, 48, 31, 50, 1,
+- 35, 53, 49, 5, 6, 7, 8, 9, 10, 11,
+- 49, 13, 14, 15, 16, 17, 18, 19, 20, 21,
+- 22, 49, 24, 25, 26, 27, 28, 49, 49, 31,
+- 32, 49, 49, 1, 97, 83, 38, 156, 115, 50,
+- 42, 110, -1, 45, 46, -1, 48, 106, 50, 1,
+- -1, 53, -1, 5, 6, 7, 8, 9, 10, 11,
+- 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
+- 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
+- 32, -1, -1, -1, -1, -1, 38, -1, -1, -1,
+- 42, -1, -1, 45, -1, 1, 48, -1, 50, 5,
+- 6, 7, 8, 9, 10, 11, -1, 13, 14, 15,
+- 16, 17, 18, 19, 20, 21, 22, -1, 24, 25,
+- 26, 27, 28, -1, -1, 31, 32, -1, -1, -1,
+- -1, 37, -1, -1, -1, -1, 42, -1, -1, -1,
+- 1, -1, -1, 49, 5, 6, 7, 8, 9, 10,
+- 11, -1, 13, 14, 15, 16, 17, 18, 19, 20,
+- 21, 22, -1, 24, 25, 26, 27, 28, -1, -1,
+- 31, 32, -1, -1, -1, -1, 37, -1, -1, -1,
+- -1, 42, -1, -1, -1, 1, -1, -1, 49, 5,
+- 6, 7, 8, 9, 10, 11, -1, 13, 14, 15,
+- 16, 17, 18, 19, 20, 21, 22, -1, 24, 25,
+- 26, 27, 28, -1, -1, 31, 32, -1, -1, -1,
+- -1, 37, -1, -1, -1, -1, 42, -1, -1, -1,
+- -1, -1, -1, 49, 5, 6, 7, 8, 9, 10,
+- 11, -1, 13, 14, 15, 16, 17, 18, 19, 20,
+- 21, 22, -1, 24, 25, 26, 27, 28, -1, -1,
+- 31, 32, -1, -1, -1, -1, -1, 38, -1, -1,
+- -1, 42, -1, -1, -1, -1, -1, 48, -1, 50,
+- 5, 6, 7, 8, 9, 10, 11, -1, 13, 14,
+- 15, 16, 17, 18, 19, 20, 21, 22, -1, 24,
+- 25, 26, 27, 28, -1, -1, 31, 32, -1, -1,
+- -1, -1, 37, -1, -1, -1, -1, 42, 5, 6,
++ 60, 60, 3, 81, 1, 66, 39, 38, 26, 57,
++ 88, 31, 38, 1, 38, 38, 42, 38, 152, 111,
++ 30, 113, 48, 33, 50, 46, 160, 53, 52, 52,
++ 78, 51, 93, 111, 65, 113, 54, 34, 0, 70,
++ 58, 38, 102, 23, 38, 42, 48, 8, 126, 127,
++ 38, 48, 49, 50, 42, 88, 57, 18, 52, 34,
++ 48, 34, 50, 48, 34, 52, 27, 45, 46, 45,
++ 31, 45, 46, 48, 38, 48, 154, 78, 48, 38,
++ 46, 47, 38, 42, 38, 126, 127, 52, 42, 48,
++ 45, 50, 152, 38, 48, 47, 50, 42, 51, 46,
++ 160, 49, 35, 48, 53, 50, 49, 1, 49, 169,
++ 169, 5, 6, 7, 8, 9, 10, 11, 35, 13,
++ 14, 15, 16, 17, 18, 19, 20, 21, 22, 45,
++ 24, 25, 26, 27, 28, 47, 45, 31, 32, 30,
++ 45, 49, 49, 47, 38, 37, 49, 49, 42, 31,
++ 49, 45, 46, 49, 48, 35, 50, 1, 1, 53,
++ 49, 5, 6, 7, 8, 9, 10, 11, 49, 13,
++ 14, 15, 16, 17, 18, 19, 20, 21, 22, 49,
++ 24, 25, 26, 27, 28, 49, 96, 31, 32, 109,
++ 83, 154, 114, 50, 38, -1, -1, -1, 42, 105,
++ -1, 45, 46, -1, 48, -1, 50, 1, -1, 53,
++ -1, 5, 6, 7, 8, 9, 10, 11, 12, 13,
++ 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
++ 24, 25, 26, 27, 28, 29, 30, 31, 32, -1,
++ -1, -1, -1, -1, 38, -1, -1, -1, 42, -1,
++ -1, 45, -1, 1, 48, -1, 50, 5, 6, 7,
++ 8, 9, 10, 11, -1, 13, 14, 15, 16, 17,
++ 18, 19, 20, 21, 22, -1, 24, 25, 26, 27,
++ 28, -1, -1, 31, 32, -1, -1, -1, -1, 37,
++ -1, -1, -1, -1, 42, -1, -1, -1, 1, -1,
++ -1, 49, 5, 6, 7, 8, 9, 10, 11, -1,
++ 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
++ -1, 24, 25, 26, 27, 28, -1, -1, 31, 32,
++ -1, -1, -1, -1, 37, -1, -1, -1, -1, 42,
++ -1, -1, -1, 1, -1, -1, 49, 5, 6, 7,
++ 8, 9, 10, 11, -1, 13, 14, 15, 16, 17,
++ 18, 19, 20, 21, 22, -1, 24, 25, 26, 27,
++ 28, -1, -1, 31, 32, -1, -1, -1, -1, 37,
++ -1, -1, -1, -1, 42, -1, -1, -1, -1, -1,
++ -1, 49, 5, 6, 7, 8, 9, 10, 11, -1,
++ 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
++ -1, 24, 25, 26, 27, 28, -1, -1, 31, 32,
++ -1, -1, -1, -1, -1, 38, -1, -1, -1, 42,
++ -1, -1, -1, -1, -1, 48, -1, 50, 5, 6,
+ 7, 8, 9, 10, 11, -1, 13, 14, 15, 16,
+ 17, 18, 19, 20, 21, 22, -1, 24, 25, 26,
+ 27, 28, -1, -1, 31, 32, -1, -1, -1, -1,
+- -1, -1, -1, -1, -1, 42
++ 37, -1, -1, -1, -1, 42, 5, 6, 7, 8,
++ 9, 10, 11, -1, 13, 14, 15, 16, 17, 18,
++ 19, 20, 21, 22, -1, 24, 25, 26, 27, 28,
++ -1, -1, 31, 32, -1, -1, -1, -1, -1, -1,
++ -1, -1, -1, 42
+ };
+
+-/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
+- symbol of state STATE-NUM. */
++ /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
++ symbol of state STATE-NUM. */
+ static const yytype_uint8 yystos[] =
+ {
+ 0, 55, 56, 57, 0, 56, 1, 5, 6, 7,
+@@ -869,42 +785,66 @@ static const yytype_uint8 yystos[] =
+ 48, 48, 45, 38, 42, 48, 50, 62, 63, 64,
+ 71, 75, 76, 67, 97, 38, 98, 99, 59, 88,
+ 1, 65, 89, 90, 91, 61, 65, 88, 66, 82,
+- 38, 1, 75, 72, 73, 74, 45, 47, 75, 30,
+- 33, 101, 34, 48, 51, 46, 47, 61, 45, 46,
+- 38, 42, 48, 53, 71, 77, 78, 92, 93, 94,
+- 95, 46, 1, 91, 75, 38, 42, 48, 71, 83,
+- 84, 49, 49, 49, 49, 74, 64, 96, 1, 79,
+- 80, 81, 82, 35, 46, 99, 95, 1, 38, 77,
+- 35, 77, 96, 34, 48, 45, 47, 1, 42, 83,
+- 83, 34, 48, 45, 31, 51, 86, 87, 49, 49,
+- 37, 47, 49, 49, 1, 79, 94, 49, 49, 1,
+- 79, 35, 37, 82, 49, 49, 49, 49
++ 38, 75, 72, 73, 74, 45, 47, 75, 30, 33,
++ 101, 34, 48, 51, 46, 47, 61, 45, 46, 38,
++ 42, 48, 53, 71, 77, 78, 92, 93, 94, 95,
++ 46, 1, 91, 75, 38, 42, 48, 71, 83, 84,
++ 49, 49, 49, 74, 64, 96, 1, 79, 80, 81,
++ 82, 35, 46, 99, 95, 1, 38, 77, 35, 77,
++ 96, 34, 48, 45, 47, 1, 42, 83, 83, 34,
++ 48, 45, 31, 51, 86, 87, 49, 49, 37, 47,
++ 49, 49, 1, 79, 94, 49, 49, 1, 79, 35,
++ 37, 82, 49, 49, 49, 49
+ };
+
+-#define yyerrok (yyerrstatus = 0)
+-#define yyclearin (yychar = YYEMPTY)
+-#define YYEMPTY (-2)
+-#define YYEOF 0
+-
+-#define YYACCEPT goto yyacceptlab
+-#define YYABORT goto yyabortlab
+-#define YYERROR goto yyerrorlab
+-
+-
+-/* Like YYERROR except do call yyerror. This remains here temporarily
+- to ease the transition to the new meaning of YYERROR, for GCC.
+- Once GCC version 2 has supplanted version 1, this can go. However,
+- YYFAIL appears to be in use. Nevertheless, it is formally deprecated
+- in Bison 2.4.2's NEWS entry, where a plan to phase it out is
+- discussed. */
+-
+-#define YYFAIL goto yyerrlab
+-#if defined YYFAIL
+- /* This is here to suppress warnings from the GCC cpp's
+- -Wunused-macros. Normally we don't worry about that warning, but
+- some users do, and we want to make it easy for users to remove
+- YYFAIL uses, which will produce warnings from Bison 2.5. */
+-#endif
++ /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
++static const yytype_uint8 yyr1[] =
++{
++ 0, 54, 55, 55, 57, 56, 59, 58, 60, 58,
++ 58, 58, 58, 58, 58, 58, 61, 62, 62, 63,
++ 63, 64, 65, 65, 66, 66, 67, 67, 68, 68,
++ 68, 68, 68, 69, 69, 69, 69, 69, 69, 69,
++ 69, 69, 69, 69, 69, 69, 70, 70, 70, 70,
++ 70, 70, 70, 70, 70, 70, 70, 71, 72, 72,
++ 73, 73, 74, 74, 74, 74, 75, 75, 76, 76,
++ 76, 76, 76, 76, 77, 77, 78, 78, 78, 78,
++ 78, 78, 78, 79, 79, 79, 80, 80, 81, 81,
++ 82, 83, 83, 84, 84, 84, 84, 84, 84, 84,
++ 84, 85, 86, 86, 87, 88, 88, 89, 89, 90,
++ 90, 91, 91, 92, 92, 93, 93, 94, 94, 94,
++ 95, 96, 96, 97, 97, 98, 98, 99, 99, 100,
++ 101, 101, 102
++};
++
++ /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
++static const yytype_uint8 yyr2[] =
++{
++ 0, 2, 1, 2, 0, 2, 0, 4, 0, 3,
++ 1, 1, 1, 1, 2, 2, 3, 0, 1, 1,
++ 3, 4, 0, 1, 1, 2, 1, 1, 1, 1,
++ 1, 1, 1, 1, 1, 4, 1, 2, 2, 2,
++ 3, 3, 3, 2, 2, 2, 1, 1, 1, 1,
++ 1, 1, 1, 1, 1, 1, 1, 2, 0, 1,
++ 1, 2, 1, 1, 1, 1, 2, 1, 1, 1,
++ 4, 4, 2, 3, 2, 1, 1, 1, 4, 4,
++ 2, 3, 3, 2, 1, 3, 0, 1, 1, 3,
++ 2, 2, 1, 0, 1, 1, 4, 4, 2, 3,
++ 3, 3, 0, 1, 2, 3, 3, 0, 1, 1,
++ 2, 3, 2, 0, 1, 1, 3, 2, 2, 1,
++ 2, 0, 2, 3, 4, 1, 3, 1, 3, 2,
++ 0, 1, 5
++};
++
++
++#define yyerrok (yyerrstatus = 0)
++#define yyclearin (yychar = YYEMPTY)
++#define YYEMPTY (-2)
++#define YYEOF 0
++
++#define YYACCEPT goto yyacceptlab
++#define YYABORT goto yyabortlab
++#define YYERROR goto yyerrorlab
++
+
+ #define YYRECOVERING() (!!yyerrstatus)
+
+@@ -921,27 +861,15 @@ do
+ else \
+ { \
+ yyerror (YY_("syntax error: cannot back up")); \
+- YYERROR; \
+- } \
+-while (YYID (0))
++ YYERROR; \
++ } \
++while (0)
+
+ /* Error token number */
+-#define YYTERROR 1
+-#define YYERRCODE 256
++#define YYTERROR 1
++#define YYERRCODE 256
+
+
+-/* This macro is provided for backward compatibility. */
+-#ifndef YY_LOCATION_PRINT
+-# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
+-#endif
+-
+-
+-/* YYLEX -- calling `yylex' with the right arguments. */
+-#ifdef YYLEX_PARAM
+-# define YYLEX yylex (YYLEX_PARAM)
+-#else
+-# define YYLEX yylex ()
+-#endif
+
+ /* Enable debugging if requested. */
+ #if YYDEBUG
+@@ -951,40 +879,36 @@ while (YYID (0))
+ # define YYFPRINTF fprintf
+ # endif
+
+-# define YYDPRINTF(Args) \
+-do { \
+- if (yydebug) \
+- YYFPRINTF Args; \
+-} while (YYID (0))
+-
+-# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
+-do { \
+- if (yydebug) \
+- { \
+- YYFPRINTF (stderr, "%s ", Title); \
+- yy_symbol_print (stderr, \
+- Type, Value); \
+- YYFPRINTF (stderr, "\n"); \
+- } \
+-} while (YYID (0))
++# define YYDPRINTF(Args) \
++do { \
++ if (yydebug) \
++ YYFPRINTF Args; \
++} while (0)
+
++/* This macro is provided for backward compatibility. */
++#ifndef YY_LOCATION_PRINT
++# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
++#endif
++
++
++# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
++do { \
++ if (yydebug) \
++ { \
++ YYFPRINTF (stderr, "%s ", Title); \
++ yy_symbol_print (stderr, \
++ Type, Value); \
++ YYFPRINTF (stderr, "\n"); \
++ } \
++} while (0)
+
+-/*--------------------------------.
+-| Print this symbol on YYOUTPUT. |
+-`--------------------------------*/
+
+-/*ARGSUSED*/
+-#if (defined __STDC__ || defined __C99__FUNC__ \
+- || defined __cplusplus || defined _MSC_VER)
++/*----------------------------------------.
++| Print this symbol's value on YYOUTPUT. |
++`----------------------------------------*/
++
+ static void
+ yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
+-#else
+-static void
+-yy_symbol_value_print (yyoutput, yytype, yyvaluep)
+- FILE *yyoutput;
+- int yytype;
+- YYSTYPE const * const yyvaluep;
+-#endif
+ {
+ FILE *yyo = yyoutput;
+ YYUSE (yyo);
+@@ -993,14 +917,8 @@ yy_symbol_value_print (yyoutput, yytype,
+ # ifdef YYPRINT
+ if (yytype < YYNTOKENS)
+ YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
+-# else
+- YYUSE (yyoutput);
+ # endif
+- switch (yytype)
+- {
+- default:
+- break;
+- }
++ YYUSE (yytype);
+ }
+
+
+@@ -1008,22 +926,11 @@ yy_symbol_value_print (yyoutput, yytype,
+ | Print this symbol on YYOUTPUT. |
+ `--------------------------------*/
+
+-#if (defined __STDC__ || defined __C99__FUNC__ \
+- || defined __cplusplus || defined _MSC_VER)
+ static void
+ yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
+-#else
+-static void
+-yy_symbol_print (yyoutput, yytype, yyvaluep)
+- FILE *yyoutput;
+- int yytype;
+- YYSTYPE const * const yyvaluep;
+-#endif
+ {
+- if (yytype < YYNTOKENS)
+- YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
+- else
+- YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
++ YYFPRINTF (yyoutput, "%s %s (",
++ yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
+
+ yy_symbol_value_print (yyoutput, yytype, yyvaluep);
+ YYFPRINTF (yyoutput, ")");
+@@ -1034,16 +941,8 @@ yy_symbol_print (yyoutput, yytype, yyval
+ | TOP (included). |
+ `------------------------------------------------------------------*/
+
+-#if (defined __STDC__ || defined __C99__FUNC__ \
+- || defined __cplusplus || defined _MSC_VER)
+ static void
+ yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
+-#else
+-static void
+-yy_stack_print (yybottom, yytop)
+- yytype_int16 *yybottom;
+- yytype_int16 *yytop;
+-#endif
+ {
+ YYFPRINTF (stderr, "Stack now");
+ for (; yybottom <= yytop; yybottom++)
+@@ -1054,49 +953,42 @@ yy_stack_print (yybottom, yytop)
+ YYFPRINTF (stderr, "\n");
+ }
+
+-# define YY_STACK_PRINT(Bottom, Top) \
+-do { \
+- if (yydebug) \
+- yy_stack_print ((Bottom), (Top)); \
+-} while (YYID (0))
++# define YY_STACK_PRINT(Bottom, Top) \
++do { \
++ if (yydebug) \
++ yy_stack_print ((Bottom), (Top)); \
++} while (0)
+
+
+ /*------------------------------------------------.
+ | Report that the YYRULE is going to be reduced. |
+ `------------------------------------------------*/
+
+-#if (defined __STDC__ || defined __C99__FUNC__ \
+- || defined __cplusplus || defined _MSC_VER)
+-static void
+-yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
+-#else
+ static void
+-yy_reduce_print (yyvsp, yyrule)
+- YYSTYPE *yyvsp;
+- int yyrule;
+-#endif
++yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule)
+ {
++ unsigned long int yylno = yyrline[yyrule];
+ int yynrhs = yyr2[yyrule];
+ int yyi;
+- unsigned long int yylno = yyrline[yyrule];
+ YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
+- yyrule - 1, yylno);
++ yyrule - 1, yylno);
+ /* The symbols being reduced. */
+ for (yyi = 0; yyi < yynrhs; yyi++)
+ {
+ YYFPRINTF (stderr, " $%d = ", yyi + 1);
+- yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
+- &(yyvsp[(yyi + 1) - (yynrhs)])
+- );
++ yy_symbol_print (stderr,
++ yystos[yyssp[yyi + 1 - yynrhs]],
++ &(yyvsp[(yyi + 1) - (yynrhs)])
++ );
+ YYFPRINTF (stderr, "\n");
+ }
+ }
+
+-# define YY_REDUCE_PRINT(Rule) \
+-do { \
+- if (yydebug) \
+- yy_reduce_print (yyvsp, Rule); \
+-} while (YYID (0))
++# define YY_REDUCE_PRINT(Rule) \
++do { \
++ if (yydebug) \
++ yy_reduce_print (yyssp, yyvsp, Rule); \
++} while (0)
+
+ /* Nonzero means print parse trace. It is left uninitialized so that
+ multiple parsers can coexist. */
+@@ -1110,7 +1002,7 @@ int yydebug;
+
+
+ /* YYINITDEPTH -- initial size of the parser's stacks. */
+-#ifndef YYINITDEPTH
++#ifndef YYINITDEPTH
+ # define YYINITDEPTH 200
+ #endif
+
+@@ -1133,15 +1025,8 @@ int yydebug;
+ # define yystrlen strlen
+ # else
+ /* Return the length of YYSTR. */
+-#if (defined __STDC__ || defined __C99__FUNC__ \
+- || defined __cplusplus || defined _MSC_VER)
+ static YYSIZE_T
+ yystrlen (const char *yystr)
+-#else
+-static YYSIZE_T
+-yystrlen (yystr)
+- const char *yystr;
+-#endif
+ {
+ YYSIZE_T yylen;
+ for (yylen = 0; yystr[yylen]; yylen++)
+@@ -1157,16 +1042,8 @@ yystrlen (yystr)
+ # else
+ /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
+ YYDEST. */
+-#if (defined __STDC__ || defined __C99__FUNC__ \
+- || defined __cplusplus || defined _MSC_VER)
+ static char *
+ yystpcpy (char *yydest, const char *yysrc)
+-#else
+-static char *
+-yystpcpy (yydest, yysrc)
+- char *yydest;
+- const char *yysrc;
+-#endif
+ {
+ char *yyd = yydest;
+ const char *yys = yysrc;
+@@ -1196,27 +1073,27 @@ yytnamerr (char *yyres, const char *yyst
+ char const *yyp = yystr;
+
+ for (;;)
+- switch (*++yyp)
+- {
+- case '\'':
+- case ',':
+- goto do_not_strip_quotes;
+-
+- case '\\':
+- if (*++yyp != '\\')
+- goto do_not_strip_quotes;
+- /* Fall through. */
+- default:
+- if (yyres)
+- yyres[yyn] = *yyp;
+- yyn++;
+- break;
+-
+- case '"':
+- if (yyres)
+- yyres[yyn] = '\0';
+- return yyn;
+- }
++ switch (*++yyp)
++ {
++ case '\'':
++ case ',':
++ goto do_not_strip_quotes;
++
++ case '\\':
++ if (*++yyp != '\\')
++ goto do_not_strip_quotes;
++ /* Fall through. */
++ default:
++ if (yyres)
++ yyres[yyn] = *yyp;
++ yyn++;
++ break;
++
++ case '"':
++ if (yyres)
++ yyres[yyn] = '\0';
++ return yyn;
++ }
+ do_not_strip_quotes: ;
+ }
+
+@@ -1239,11 +1116,11 @@ static int
+ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
+ yytype_int16 *yyssp, int yytoken)
+ {
+- YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]);
++ YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
+ YYSIZE_T yysize = yysize0;
+ enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
+ /* Internationalized format string. */
+- const char *yyformat = YY_NULL;
++ const char *yyformat = YY_NULLPTR;
+ /* Arguments of yyformat. */
+ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
+ /* Number of reported tokens (one for the "unexpected", one per
+@@ -1251,10 +1128,6 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, c
+ int yycount = 0;
+
+ /* There are many possibilities here to consider:
+- - Assume YYFAIL is not used. It's too flawed to consider. See
+- <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
+- for details. YYERROR is fine as it does not invoke this
+- function.
+ - If this state is a consistent state with a default action, then
+ the only way this function was invoked is if the default action
+ is an error action. In that case, don't check for expected
+@@ -1304,7 +1177,7 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, c
+ }
+ yyarg[yycount++] = yytname[yyx];
+ {
+- YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]);
++ YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
+ if (! (yysize <= yysize1
+ && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+ return 2;
+@@ -1371,31 +1244,17 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, c
+ | Release the memory associated to this symbol. |
+ `-----------------------------------------------*/
+
+-/*ARGSUSED*/
+-#if (defined __STDC__ || defined __C99__FUNC__ \
+- || defined __cplusplus || defined _MSC_VER)
+ static void
+ yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
+-#else
+-static void
+-yydestruct (yymsg, yytype, yyvaluep)
+- const char *yymsg;
+- int yytype;
+- YYSTYPE *yyvaluep;
+-#endif
+ {
+ YYUSE (yyvaluep);
+-
+ if (!yymsg)
+ yymsg = "Deleting";
+ YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
+
+- switch (yytype)
+- {
+-
+- default:
+- break;
+- }
++ YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
++ YYUSE (yytype);
++ YY_IGNORE_MAYBE_UNINITIALIZED_END
+ }
+
+
+@@ -1404,18 +1263,8 @@ yydestruct (yymsg, yytype, yyvaluep)
+ /* The lookahead symbol. */
+ int yychar;
+
+-
+-#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+-# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+-# define YY_IGNORE_MAYBE_UNINITIALIZED_END
+-#endif
+-#ifndef YY_INITIAL_VALUE
+-# define YY_INITIAL_VALUE(Value) /* Nothing. */
+-#endif
+-
+ /* The semantic value of the lookahead symbol. */
+-YYSTYPE yylval YY_INITIAL_VALUE(yyval_default);
+-
++YYSTYPE yylval;
+ /* Number of syntax errors so far. */
+ int yynerrs;
+
+@@ -1424,35 +1273,16 @@ int yynerrs;
+ | yyparse. |
+ `----------*/
+
+-#ifdef YYPARSE_PARAM
+-#if (defined __STDC__ || defined __C99__FUNC__ \
+- || defined __cplusplus || defined _MSC_VER)
+-int
+-yyparse (void *YYPARSE_PARAM)
+-#else
+-int
+-yyparse (YYPARSE_PARAM)
+- void *YYPARSE_PARAM;
+-#endif
+-#else /* ! YYPARSE_PARAM */
+-#if (defined __STDC__ || defined __C99__FUNC__ \
+- || defined __cplusplus || defined _MSC_VER)
+ int
+ yyparse (void)
+-#else
+-int
+-yyparse ()
+-
+-#endif
+-#endif
+ {
+ int yystate;
+ /* Number of tokens to shift before error messages enabled. */
+ int yyerrstatus;
+
+ /* The stacks and their tools:
+- `yyss': related to states.
+- `yyvs': related to semantic values.
++ 'yyss': related to states.
++ 'yyvs': related to semantic values.
+
+ Refer to the stacks through separate pointers, to allow yyoverflow
+ to reallocate them elsewhere. */
+@@ -1520,23 +1350,23 @@ yyparse ()
+
+ #ifdef yyoverflow
+ {
+- /* Give user a chance to reallocate the stack. Use copies of
+- these so that the &'s don't force the real ones into
+- memory. */
+- YYSTYPE *yyvs1 = yyvs;
+- yytype_int16 *yyss1 = yyss;
+-
+- /* Each stack pointer address is followed by the size of the
+- data in use in that stack, in bytes. This used to be a
+- conditional around just the two extra args, but that might
+- be undefined if yyoverflow is a macro. */
+- yyoverflow (YY_("memory exhausted"),
+- &yyss1, yysize * sizeof (*yyssp),
+- &yyvs1, yysize * sizeof (*yyvsp),
+- &yystacksize);
++ /* Give user a chance to reallocate the stack. Use copies of
++ these so that the &'s don't force the real ones into
++ memory. */
++ YYSTYPE *yyvs1 = yyvs;
++ yytype_int16 *yyss1 = yyss;
++
++ /* Each stack pointer address is followed by the size of the
++ data in use in that stack, in bytes. This used to be a
++ conditional around just the two extra args, but that might
++ be undefined if yyoverflow is a macro. */
++ yyoverflow (YY_("memory exhausted"),
++ &yyss1, yysize * sizeof (*yyssp),
++ &yyvs1, yysize * sizeof (*yyvsp),
++ &yystacksize);
+
+- yyss = yyss1;
+- yyvs = yyvs1;
++ yyss = yyss1;
++ yyvs = yyvs1;
+ }
+ #else /* no yyoverflow */
+ # ifndef YYSTACK_RELOCATE
+@@ -1544,22 +1374,22 @@ yyparse ()
+ # else
+ /* Extend the stack our own way. */
+ if (YYMAXDEPTH <= yystacksize)
+- goto yyexhaustedlab;
++ goto yyexhaustedlab;
+ yystacksize *= 2;
+ if (YYMAXDEPTH < yystacksize)
+- yystacksize = YYMAXDEPTH;
++ yystacksize = YYMAXDEPTH;
+
+ {
+- yytype_int16 *yyss1 = yyss;
+- union yyalloc *yyptr =
+- (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
+- if (! yyptr)
+- goto yyexhaustedlab;
+- YYSTACK_RELOCATE (yyss_alloc, yyss);
+- YYSTACK_RELOCATE (yyvs_alloc, yyvs);
++ yytype_int16 *yyss1 = yyss;
++ union yyalloc *yyptr =
++ (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
++ if (! yyptr)
++ goto yyexhaustedlab;
++ YYSTACK_RELOCATE (yyss_alloc, yyss);
++ YYSTACK_RELOCATE (yyvs_alloc, yyvs);
+ # undef YYSTACK_RELOCATE
+- if (yyss1 != yyssa)
+- YYSTACK_FREE (yyss1);
++ if (yyss1 != yyssa)
++ YYSTACK_FREE (yyss1);
+ }
+ # endif
+ #endif /* no yyoverflow */
+@@ -1568,10 +1398,10 @@ yyparse ()
+ yyvsp = yyvs + yysize - 1;
+
+ YYDPRINTF ((stderr, "Stack size increased to %lu\n",
+- (unsigned long int) yystacksize));
++ (unsigned long int) yystacksize));
+
+ if (yyss + yystacksize - 1 <= yyssp)
+- YYABORT;
++ YYABORT;
+ }
+
+ YYDPRINTF ((stderr, "Entering state %d\n", yystate));
+@@ -1600,7 +1430,7 @@ yybackup:
+ if (yychar == YYEMPTY)
+ {
+ YYDPRINTF ((stderr, "Reading a token: "));
+- yychar = YYLEX;
++ yychar = yylex ();
+ }
+
+ if (yychar <= YYEOF)
+@@ -1665,7 +1495,7 @@ yyreduce:
+ yylen = yyr2[yyn];
+
+ /* If YYLEN is nonzero, implement the default value of the action:
+- `$$ = $1'.
++ '$$ = $1'.
+
+ Otherwise, the following line sets YYVAL to garbage.
+ This behavior is undocumented and Bison
+@@ -1679,483 +1509,560 @@ yyreduce:
+ switch (yyn)
+ {
+ case 4:
+-
++#line 129 "parse.y" /* yacc.c:1646 */
+ { is_typedef = 0; is_extern = 0; current_name = NULL; decl_spec = NULL; }
++#line 1515 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+ case 5:
+-
+- { free_list(*(yyvsp[(2) - (2)]), NULL); *(yyvsp[(2) - (2)]) = NULL; }
++#line 131 "parse.y" /* yacc.c:1646 */
++ { free_list(*(yyvsp[0]), NULL); *(yyvsp[0]) = NULL; }
++#line 1521 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+ case 6:
+-
++#line 135 "parse.y" /* yacc.c:1646 */
+ { is_typedef = 1; }
++#line 1527 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+ case 7:
+-
+- { (yyval) = (yyvsp[(4) - (4)]); }
++#line 136 "parse.y" /* yacc.c:1646 */
++ { (yyval) = (yyvsp[0]); }
++#line 1533 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+ case 8:
+-
++#line 137 "parse.y" /* yacc.c:1646 */
+ { is_typedef = 1; }
++#line 1539 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+ case 9:
+-
+- { (yyval) = (yyvsp[(3) - (3)]); }
++#line 138 "parse.y" /* yacc.c:1646 */
++ { (yyval) = (yyvsp[0]); }
++#line 1545 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+ case 14:
+-
+- { (yyval) = (yyvsp[(2) - (2)]); }
++#line 143 "parse.y" /* yacc.c:1646 */
++ { (yyval) = (yyvsp[0]); }
++#line 1551 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+ case 15:
+-
+- { (yyval) = (yyvsp[(2) - (2)]); }
++#line 144 "parse.y" /* yacc.c:1646 */
++ { (yyval) = (yyvsp[0]); }
++#line 1557 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+ case 16:
+-
++#line 149 "parse.y" /* yacc.c:1646 */
+ { if (current_name) {
+- struct string_list *decl = (*(yyvsp[(3) - (3)]))->next;
+- (*(yyvsp[(3) - (3)]))->next = NULL;
++ struct string_list *decl = (*(yyvsp[0]))->next;
++ (*(yyvsp[0]))->next = NULL;
+ add_symbol(current_name,
+ is_typedef ? SYM_TYPEDEF : SYM_NORMAL,
+ decl, is_extern);
+ current_name = NULL;
+ }
+- (yyval) = (yyvsp[(3) - (3)]);
++ (yyval) = (yyvsp[0]);
+ }
++#line 1572 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+ case 17:
+-
++#line 162 "parse.y" /* yacc.c:1646 */
+ { (yyval) = NULL; }
++#line 1578 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+ case 19:
+-
+- { struct string_list *decl = *(yyvsp[(1) - (1)]);
+- *(yyvsp[(1) - (1)]) = NULL;
++#line 168 "parse.y" /* yacc.c:1646 */
++ { struct string_list *decl = *(yyvsp[0]);
++ *(yyvsp[0]) = NULL;
+ add_symbol(current_name,
+ is_typedef ? SYM_TYPEDEF : SYM_NORMAL, decl, is_extern);
+ current_name = NULL;
+- (yyval) = (yyvsp[(1) - (1)]);
++ (yyval) = (yyvsp[0]);
+ }
++#line 1590 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+ case 20:
+-
+- { struct string_list *decl = *(yyvsp[(3) - (3)]);
+- *(yyvsp[(3) - (3)]) = NULL;
+- free_list(*(yyvsp[(2) - (3)]), NULL);
+- *(yyvsp[(2) - (3)]) = decl_spec;
++#line 176 "parse.y" /* yacc.c:1646 */
++ { struct string_list *decl = *(yyvsp[0]);
++ *(yyvsp[0]) = NULL;
++ free_list(*(yyvsp[-1]), NULL);
++ *(yyvsp[-1]) = decl_spec;
+ add_symbol(current_name,
+ is_typedef ? SYM_TYPEDEF : SYM_NORMAL, decl, is_extern);
+ current_name = NULL;
+- (yyval) = (yyvsp[(3) - (3)]);
++ (yyval) = (yyvsp[0]);
+ }
++#line 1604 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+ case 21:
+-
+- { (yyval) = (yyvsp[(4) - (4)]) ? (yyvsp[(4) - (4)]) : (yyvsp[(3) - (4)]) ? (yyvsp[(3) - (4)]) : (yyvsp[(2) - (4)]) ? (yyvsp[(2) - (4)]) : (yyvsp[(1) - (4)]); }
++#line 189 "parse.y" /* yacc.c:1646 */
++ { (yyval) = (yyvsp[0]) ? (yyvsp[0]) : (yyvsp[-1]) ? (yyvsp[-1]) : (yyvsp[-2]) ? (yyvsp[-2]) : (yyvsp[-3]); }
++#line 1610 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+ case 22:
+-
++#line 194 "parse.y" /* yacc.c:1646 */
+ { decl_spec = NULL; }
++#line 1616 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+ case 24:
+-
+- { decl_spec = *(yyvsp[(1) - (1)]); }
++#line 199 "parse.y" /* yacc.c:1646 */
++ { decl_spec = *(yyvsp[0]); }
++#line 1622 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+ case 25:
+-
+- { decl_spec = *(yyvsp[(2) - (2)]); }
++#line 200 "parse.y" /* yacc.c:1646 */
++ { decl_spec = *(yyvsp[0]); }
++#line 1628 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+ case 26:
+-
++#line 205 "parse.y" /* yacc.c:1646 */
+ { /* Version 2 checksumming ignores storage class, as that
+ is really irrelevant to the linkage. */
+- remove_node((yyvsp[(1) - (1)]));
+- (yyval) = (yyvsp[(1) - (1)]);
++ remove_node((yyvsp[0]));
++ (yyval) = (yyvsp[0]);
+ }
++#line 1638 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+ case 31:
+-
+- { is_extern = 1; (yyval) = (yyvsp[(1) - (1)]); }
++#line 217 "parse.y" /* yacc.c:1646 */
++ { is_extern = 1; (yyval) = (yyvsp[0]); }
++#line 1644 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+ case 32:
+-
+- { is_extern = 0; (yyval) = (yyvsp[(1) - (1)]); }
++#line 218 "parse.y" /* yacc.c:1646 */
++ { is_extern = 0; (yyval) = (yyvsp[0]); }
++#line 1650 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+ case 37:
+-
+- { remove_node((yyvsp[(1) - (2)])); (*(yyvsp[(2) - (2)]))->tag = SYM_STRUCT; (yyval) = (yyvsp[(2) - (2)]); }
++#line 230 "parse.y" /* yacc.c:1646 */
++ { remove_node((yyvsp[-1])); (*(yyvsp[0]))->tag = SYM_STRUCT; (yyval) = (yyvsp[0]); }
++#line 1656 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+ case 38:
+-
+- { remove_node((yyvsp[(1) - (2)])); (*(yyvsp[(2) - (2)]))->tag = SYM_UNION; (yyval) = (yyvsp[(2) - (2)]); }
++#line 232 "parse.y" /* yacc.c:1646 */
++ { remove_node((yyvsp[-1])); (*(yyvsp[0]))->tag = SYM_UNION; (yyval) = (yyvsp[0]); }
++#line 1662 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+ case 39:
+-
+- { remove_node((yyvsp[(1) - (2)])); (*(yyvsp[(2) - (2)]))->tag = SYM_ENUM; (yyval) = (yyvsp[(2) - (2)]); }
++#line 234 "parse.y" /* yacc.c:1646 */
++ { remove_node((yyvsp[-1])); (*(yyvsp[0]))->tag = SYM_ENUM; (yyval) = (yyvsp[0]); }
++#line 1668 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+ case 40:
+-
+- { record_compound((yyvsp[(1) - (3)]), (yyvsp[(2) - (3)]), (yyvsp[(3) - (3)]), SYM_STRUCT); (yyval) = (yyvsp[(3) - (3)]); }
++#line 238 "parse.y" /* yacc.c:1646 */
++ { record_compound((yyvsp[-2]), (yyvsp[-1]), (yyvsp[0]), SYM_STRUCT); (yyval) = (yyvsp[0]); }
++#line 1674 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+ case 41:
+-
+- { record_compound((yyvsp[(1) - (3)]), (yyvsp[(2) - (3)]), (yyvsp[(3) - (3)]), SYM_UNION); (yyval) = (yyvsp[(3) - (3)]); }
++#line 240 "parse.y" /* yacc.c:1646 */
++ { record_compound((yyvsp[-2]), (yyvsp[-1]), (yyvsp[0]), SYM_UNION); (yyval) = (yyvsp[0]); }
++#line 1680 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+ case 42:
+-
+- { record_compound((yyvsp[(1) - (3)]), (yyvsp[(2) - (3)]), (yyvsp[(3) - (3)]), SYM_ENUM); (yyval) = (yyvsp[(3) - (3)]); }
++#line 242 "parse.y" /* yacc.c:1646 */
++ { record_compound((yyvsp[-2]), (yyvsp[-1]), (yyvsp[0]), SYM_ENUM); (yyval) = (yyvsp[0]); }
++#line 1686 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+ case 43:
+-
+- { add_symbol(NULL, SYM_ENUM, NULL, 0); (yyval) = (yyvsp[(2) - (2)]); }
++#line 247 "parse.y" /* yacc.c:1646 */
++ { add_symbol(NULL, SYM_ENUM, NULL, 0); (yyval) = (yyvsp[0]); }
++#line 1692 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+ case 44:
+-
+- { (yyval) = (yyvsp[(2) - (2)]); }
++#line 249 "parse.y" /* yacc.c:1646 */
++ { (yyval) = (yyvsp[0]); }
++#line 1698 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+ case 45:
+-
+- { (yyval) = (yyvsp[(2) - (2)]); }
++#line 250 "parse.y" /* yacc.c:1646 */
++ { (yyval) = (yyvsp[0]); }
++#line 1704 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+ case 56:
+-
+- { (*(yyvsp[(1) - (1)]))->tag = SYM_TYPEDEF; (yyval) = (yyvsp[(1) - (1)]); }
++#line 264 "parse.y" /* yacc.c:1646 */
++ { (*(yyvsp[0]))->tag = SYM_TYPEDEF; (yyval) = (yyvsp[0]); }
++#line 1710 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+ case 57:
+-
+- { (yyval) = (yyvsp[(2) - (2)]) ? (yyvsp[(2) - (2)]) : (yyvsp[(1) - (2)]); }
++#line 269 "parse.y" /* yacc.c:1646 */
++ { (yyval) = (yyvsp[0]) ? (yyvsp[0]) : (yyvsp[-1]); }
++#line 1716 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+ case 58:
+-
++#line 273 "parse.y" /* yacc.c:1646 */
+ { (yyval) = NULL; }
++#line 1722 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+ case 61:
+-
+- { (yyval) = (yyvsp[(2) - (2)]); }
++#line 279 "parse.y" /* yacc.c:1646 */
++ { (yyval) = (yyvsp[0]); }
++#line 1728 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+ case 65:
+-
++#line 285 "parse.y" /* yacc.c:1646 */
+ { /* restrict has no effect in prototypes so ignore it */
+- remove_node((yyvsp[(1) - (1)]));
+- (yyval) = (yyvsp[(1) - (1)]);
++ remove_node((yyvsp[0]));
++ (yyval) = (yyvsp[0]);
+ }
++#line 1737 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+ case 66:
+-
+- { (yyval) = (yyvsp[(2) - (2)]); }
++#line 292 "parse.y" /* yacc.c:1646 */
++ { (yyval) = (yyvsp[0]); }
++#line 1743 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+ case 68:
+-
++#line 298 "parse.y" /* yacc.c:1646 */
+ { if (current_name != NULL) {
+ error_with_pos("unexpected second declaration name");
+ YYERROR;
+ } else {
+- current_name = (*(yyvsp[(1) - (1)]))->string;
+- (yyval) = (yyvsp[(1) - (1)]);
++ current_name = (*(yyvsp[0]))->string;
++ (yyval) = (yyvsp[0]);
+ }
+ }
++#line 1756 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+ case 69:
+-
++#line 307 "parse.y" /* yacc.c:1646 */
+ { if (current_name != NULL) {
+ error_with_pos("unexpected second declaration name");
+ YYERROR;
+ } else {
+- current_name = (*(yyvsp[(1) - (1)]))->string;
+- (yyval) = (yyvsp[(1) - (1)]);
++ current_name = (*(yyvsp[0]))->string;
++ (yyval) = (yyvsp[0]);
+ }
+ }
++#line 1769 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+ case 70:
+-
+- { (yyval) = (yyvsp[(4) - (4)]); }
++#line 316 "parse.y" /* yacc.c:1646 */
++ { (yyval) = (yyvsp[0]); }
++#line 1775 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+ case 71:
+-
+- { (yyval) = (yyvsp[(4) - (4)]); }
++#line 318 "parse.y" /* yacc.c:1646 */
++ { (yyval) = (yyvsp[0]); }
++#line 1781 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+ case 72:
+-
+- { (yyval) = (yyvsp[(2) - (2)]); }
++#line 320 "parse.y" /* yacc.c:1646 */
++ { (yyval) = (yyvsp[0]); }
++#line 1787 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+ case 73:
+-
+- { (yyval) = (yyvsp[(3) - (3)]); }
++#line 322 "parse.y" /* yacc.c:1646 */
++ { (yyval) = (yyvsp[0]); }
++#line 1793 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+ case 74:
+-
+- { (yyval) = (yyvsp[(3) - (3)]); }
++#line 328 "parse.y" /* yacc.c:1646 */
++ { (yyval) = (yyvsp[0]); }
++#line 1799 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+- case 75:
+-
+- { (yyval) = (yyvsp[(2) - (2)]); }
++ case 78:
++#line 336 "parse.y" /* yacc.c:1646 */
++ { (yyval) = (yyvsp[0]); }
++#line 1805 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+ case 79:
+-
+- { (yyval) = (yyvsp[(4) - (4)]); }
++#line 338 "parse.y" /* yacc.c:1646 */
++ { (yyval) = (yyvsp[0]); }
++#line 1811 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+ case 80:
+-
+- { (yyval) = (yyvsp[(4) - (4)]); }
++#line 340 "parse.y" /* yacc.c:1646 */
++ { (yyval) = (yyvsp[0]); }
++#line 1817 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+ case 81:
+-
+- { (yyval) = (yyvsp[(2) - (2)]); }
++#line 342 "parse.y" /* yacc.c:1646 */
++ { (yyval) = (yyvsp[0]); }
++#line 1823 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+ case 82:
+-
+- { (yyval) = (yyvsp[(3) - (3)]); }
++#line 344 "parse.y" /* yacc.c:1646 */
++ { (yyval) = (yyvsp[0]); }
++#line 1829 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+ case 83:
+-
+- { (yyval) = (yyvsp[(3) - (3)]); }
++#line 348 "parse.y" /* yacc.c:1646 */
++ { (yyval) = (yyvsp[0]); }
++#line 1835 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+- case 84:
+-
+- { (yyval) = (yyvsp[(2) - (2)]); }
++ case 85:
++#line 350 "parse.y" /* yacc.c:1646 */
++ { (yyval) = (yyvsp[0]); }
++#line 1841 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+ case 86:
+-
+- { (yyval) = (yyvsp[(3) - (3)]); }
++#line 354 "parse.y" /* yacc.c:1646 */
++ { (yyval) = NULL; }
++#line 1847 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+- case 87:
+-
+- { (yyval) = NULL; }
++ case 89:
++#line 361 "parse.y" /* yacc.c:1646 */
++ { (yyval) = (yyvsp[0]); }
++#line 1853 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+ case 90:
+-
+- { (yyval) = (yyvsp[(3) - (3)]); }
++#line 366 "parse.y" /* yacc.c:1646 */
++ { (yyval) = (yyvsp[0]) ? (yyvsp[0]) : (yyvsp[-1]); }
++#line 1859 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+ case 91:
+-
+- { (yyval) = (yyvsp[(2) - (2)]) ? (yyvsp[(2) - (2)]) : (yyvsp[(1) - (2)]); }
++#line 371 "parse.y" /* yacc.c:1646 */
++ { (yyval) = (yyvsp[0]) ? (yyvsp[0]) : (yyvsp[-1]); }
++#line 1865 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+- case 92:
+-
+- { (yyval) = (yyvsp[(2) - (2)]) ? (yyvsp[(2) - (2)]) : (yyvsp[(1) - (2)]); }
++ case 93:
++#line 376 "parse.y" /* yacc.c:1646 */
++ { (yyval) = NULL; }
++#line 1871 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+ case 94:
+-
+- { (yyval) = NULL; }
++#line 378 "parse.y" /* yacc.c:1646 */
++ { /* For version 2 checksums, we don't want to remember
++ private parameter names. */
++ remove_node((yyvsp[0]));
++ (yyval) = (yyvsp[0]);
++ }
++#line 1881 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+ case 95:
+-
+- { /* For version 2 checksums, we don't want to remember
+- private parameter names. */
+- remove_node((yyvsp[(1) - (1)]));
+- (yyval) = (yyvsp[(1) - (1)]);
++#line 386 "parse.y" /* yacc.c:1646 */
++ { remove_node((yyvsp[0]));
++ (yyval) = (yyvsp[0]);
+ }
++#line 1889 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+ case 96:
+-
+- { remove_node((yyvsp[(1) - (1)]));
+- (yyval) = (yyvsp[(1) - (1)]);
+- }
++#line 390 "parse.y" /* yacc.c:1646 */
++ { (yyval) = (yyvsp[0]); }
++#line 1895 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+ case 97:
+-
+- { (yyval) = (yyvsp[(4) - (4)]); }
++#line 392 "parse.y" /* yacc.c:1646 */
++ { (yyval) = (yyvsp[0]); }
++#line 1901 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+ case 98:
+-
+- { (yyval) = (yyvsp[(4) - (4)]); }
++#line 394 "parse.y" /* yacc.c:1646 */
++ { (yyval) = (yyvsp[0]); }
++#line 1907 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+ case 99:
+-
+- { (yyval) = (yyvsp[(2) - (2)]); }
++#line 396 "parse.y" /* yacc.c:1646 */
++ { (yyval) = (yyvsp[0]); }
++#line 1913 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+ case 100:
+-
+- { (yyval) = (yyvsp[(3) - (3)]); }
++#line 398 "parse.y" /* yacc.c:1646 */
++ { (yyval) = (yyvsp[0]); }
++#line 1919 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+ case 101:
+-
+- { (yyval) = (yyvsp[(3) - (3)]); }
+- break;
+-
+- case 102:
+-
+- { struct string_list *decl = *(yyvsp[(2) - (3)]);
+- *(yyvsp[(2) - (3)]) = NULL;
++#line 403 "parse.y" /* yacc.c:1646 */
++ { struct string_list *decl = *(yyvsp[-1]);
++ *(yyvsp[-1]) = NULL;
+ add_symbol(current_name, SYM_NORMAL, decl, is_extern);
+- (yyval) = (yyvsp[(3) - (3)]);
++ (yyval) = (yyvsp[0]);
+ }
++#line 1929 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+- case 103:
+-
++ case 102:
++#line 411 "parse.y" /* yacc.c:1646 */
+ { (yyval) = NULL; }
++#line 1935 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+- case 105:
++ case 104:
++#line 418 "parse.y" /* yacc.c:1646 */
++ { remove_list((yyvsp[0]), &(*(yyvsp[-1]))->next); (yyval) = (yyvsp[0]); }
++#line 1941 "parse.tab.c" /* yacc.c:1646 */
++ break;
+
+- { remove_list((yyvsp[(2) - (2)]), &(*(yyvsp[(1) - (2)]))->next); (yyval) = (yyvsp[(2) - (2)]); }
++ case 105:
++#line 422 "parse.y" /* yacc.c:1646 */
++ { (yyval) = (yyvsp[0]); }
++#line 1947 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+ case 106:
+-
+- { (yyval) = (yyvsp[(3) - (3)]); }
++#line 423 "parse.y" /* yacc.c:1646 */
++ { (yyval) = (yyvsp[0]); }
++#line 1953 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+ case 107:
+-
+- { (yyval) = (yyvsp[(3) - (3)]); }
++#line 427 "parse.y" /* yacc.c:1646 */
++ { (yyval) = NULL; }
++#line 1959 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+- case 108:
+-
+- { (yyval) = NULL; }
++ case 110:
++#line 433 "parse.y" /* yacc.c:1646 */
++ { (yyval) = (yyvsp[0]); }
++#line 1965 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+ case 111:
+-
+- { (yyval) = (yyvsp[(2) - (2)]); }
++#line 438 "parse.y" /* yacc.c:1646 */
++ { (yyval) = (yyvsp[0]); }
++#line 1971 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+ case 112:
+-
+- { (yyval) = (yyvsp[(3) - (3)]); }
++#line 440 "parse.y" /* yacc.c:1646 */
++ { (yyval) = (yyvsp[0]); }
++#line 1977 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+ case 113:
+-
+- { (yyval) = (yyvsp[(2) - (2)]); }
++#line 444 "parse.y" /* yacc.c:1646 */
++ { (yyval) = NULL; }
++#line 1983 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+- case 114:
+-
+- { (yyval) = NULL; }
++ case 116:
++#line 450 "parse.y" /* yacc.c:1646 */
++ { (yyval) = (yyvsp[0]); }
++#line 1989 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+ case 117:
+-
+- { (yyval) = (yyvsp[(3) - (3)]); }
++#line 454 "parse.y" /* yacc.c:1646 */
++ { (yyval) = (yyvsp[0]) ? (yyvsp[0]) : (yyvsp[-1]); }
++#line 1995 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+ case 118:
+-
+- { (yyval) = (yyvsp[(2) - (2)]) ? (yyvsp[(2) - (2)]) : (yyvsp[(1) - (2)]); }
++#line 455 "parse.y" /* yacc.c:1646 */
++ { (yyval) = (yyvsp[0]); }
++#line 2001 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+- case 119:
+-
+- { (yyval) = (yyvsp[(2) - (2)]); }
++ case 120:
++#line 460 "parse.y" /* yacc.c:1646 */
++ { (yyval) = (yyvsp[0]); }
++#line 2007 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+ case 121:
+-
+- { (yyval) = (yyvsp[(2) - (2)]); }
+- break;
+-
+- case 122:
+-
++#line 464 "parse.y" /* yacc.c:1646 */
+ { (yyval) = NULL; }
++#line 2013 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+- case 124:
+-
+- { (yyval) = (yyvsp[(3) - (3)]); }
++ case 123:
++#line 469 "parse.y" /* yacc.c:1646 */
++ { (yyval) = (yyvsp[0]); }
++#line 2019 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+- case 125:
+-
+- { (yyval) = (yyvsp[(4) - (4)]); }
++ case 124:
++#line 470 "parse.y" /* yacc.c:1646 */
++ { (yyval) = (yyvsp[0]); }
++#line 2025 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+- case 128:
+-
++ case 127:
++#line 479 "parse.y" /* yacc.c:1646 */
+ {
+- const char *name = strdup((*(yyvsp[(1) - (1)]))->string);
++ const char *name = strdup((*(yyvsp[0]))->string);
+ add_symbol(name, SYM_ENUM_CONST, NULL, 0);
+ }
++#line 2034 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+- case 129:
+-
++ case 128:
++#line 484 "parse.y" /* yacc.c:1646 */
+ {
+- const char *name = strdup((*(yyvsp[(1) - (3)]))->string);
+- struct string_list *expr = copy_list_range(*(yyvsp[(3) - (3)]), *(yyvsp[(2) - (3)]));
++ const char *name = strdup((*(yyvsp[-2]))->string);
++ struct string_list *expr = copy_list_range(*(yyvsp[0]), *(yyvsp[-1]));
+ add_symbol(name, SYM_ENUM_CONST, expr, 0);
+ }
++#line 2044 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+- case 130:
+-
+- { (yyval) = (yyvsp[(2) - (2)]); }
++ case 129:
++#line 491 "parse.y" /* yacc.c:1646 */
++ { (yyval) = (yyvsp[0]); }
++#line 2050 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+- case 131:
+-
++ case 130:
++#line 495 "parse.y" /* yacc.c:1646 */
+ { (yyval) = NULL; }
++#line 2056 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+- case 133:
+-
+- { export_symbol((*(yyvsp[(3) - (5)]))->string); (yyval) = (yyvsp[(5) - (5)]); }
++ case 132:
++#line 501 "parse.y" /* yacc.c:1646 */
++ { export_symbol((*(yyvsp[-2]))->string); (yyval) = (yyvsp[0]); }
++#line 2062 "parse.tab.c" /* yacc.c:1646 */
+ break;
+
+
+-
++#line 2066 "parse.tab.c" /* yacc.c:1646 */
+ default: break;
+ }
+ /* User semantic actions sometimes alter yychar, and that requires
+@@ -2177,7 +2084,7 @@ yyreduce:
+
+ *++yyvsp = yyval;
+
+- /* Now `shift' the result of the reduction. Determine what state
++ /* Now 'shift' the result of the reduction. Determine what state
+ that goes to, based on the state we popped back to and the rule
+ number reduced by. */
+
+@@ -2192,9 +2099,9 @@ yyreduce:
+ goto yynewstate;
+
+
+-/*------------------------------------.
+-| yyerrlab -- here on detecting error |
+-`------------------------------------*/
++/*--------------------------------------.
++| yyerrlab -- here on detecting error. |
++`--------------------------------------*/
+ yyerrlab:
+ /* Make sure we have latest lookahead translation. See comments at
+ user semantic actions for why this is necessary. */
+@@ -2245,20 +2152,20 @@ yyerrlab:
+ if (yyerrstatus == 3)
+ {
+ /* If just tried and failed to reuse lookahead token after an
+- error, discard it. */
++ error, discard it. */
+
+ if (yychar <= YYEOF)
+- {
+- /* Return failure if at end of input. */
+- if (yychar == YYEOF)
+- YYABORT;
+- }
++ {
++ /* Return failure if at end of input. */
++ if (yychar == YYEOF)
++ YYABORT;
++ }
+ else
+- {
+- yydestruct ("Error: discarding",
+- yytoken, &yylval);
+- yychar = YYEMPTY;
+- }
++ {
++ yydestruct ("Error: discarding",
++ yytoken, &yylval);
++ yychar = YYEMPTY;
++ }
+ }
+
+ /* Else will try to reuse lookahead token after shifting the error
+@@ -2277,7 +2184,7 @@ yyerrorlab:
+ if (/*CONSTCOND*/ 0)
+ goto yyerrorlab;
+
+- /* Do not reclaim the symbols of the rule which action triggered
++ /* Do not reclaim the symbols of the rule whose action triggered
+ this YYERROR. */
+ YYPOPSTACK (yylen);
+ yylen = 0;
+@@ -2290,29 +2197,29 @@ yyerrorlab:
+ | yyerrlab1 -- common code for both syntax error and YYERROR. |
+ `-------------------------------------------------------------*/
+ yyerrlab1:
+- yyerrstatus = 3; /* Each real token shifted decrements this. */
++ yyerrstatus = 3; /* Each real token shifted decrements this. */
+
+ for (;;)
+ {
+ yyn = yypact[yystate];
+ if (!yypact_value_is_default (yyn))
+- {
+- yyn += YYTERROR;
+- if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
+- {
+- yyn = yytable[yyn];
+- if (0 < yyn)
+- break;
+- }
+- }
++ {
++ yyn += YYTERROR;
++ if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
++ {
++ yyn = yytable[yyn];
++ if (0 < yyn)
++ break;
++ }
++ }
+
+ /* Pop the current state because it cannot handle the error token. */
+ if (yyssp == yyss)
+- YYABORT;
++ YYABORT;
+
+
+ yydestruct ("Error: popping",
+- yystos[yystate], yyvsp);
++ yystos[yystate], yyvsp);
+ YYPOPSTACK (1);
+ yystate = *yyssp;
+ YY_STACK_PRINT (yyss, yyssp);
+@@ -2363,14 +2270,14 @@ yyreturn:
+ yydestruct ("Cleanup: discarding lookahead",
+ yytoken, &yylval);
+ }
+- /* Do not reclaim the symbols of the rule which action triggered
++ /* Do not reclaim the symbols of the rule whose action triggered
+ this YYABORT or YYACCEPT. */
+ YYPOPSTACK (yylen);
+ YY_STACK_PRINT (yyss, yyssp);
+ while (yyssp != yyss)
+ {
+ yydestruct ("Cleanup: popping",
+- yystos[*yyssp], yyvsp);
++ yystos[*yyssp], yyvsp);
+ YYPOPSTACK (1);
+ }
+ #ifndef yyoverflow
+@@ -2381,12 +2288,9 @@ yyreturn:
+ if (yymsg != yymsgbuf)
+ YYSTACK_FREE (yymsg);
+ #endif
+- /* Make sure YYID is used. */
+- return YYID (yyresult);
++ return yyresult;
+ }
+-
+-
+-
++#line 505 "parse.y" /* yacc.c:1906 */
+
+
+ static void
+--- a/scripts/genksyms/parse.tab.h_shipped
++++ b/scripts/genksyms/parse.tab.h_shipped
+@@ -1,19 +1,19 @@
+-/* A Bison parser, made by GNU Bison 2.7. */
++/* A Bison parser, made by GNU Bison 3.0.4. */
+
+ /* Bison interface for Yacc-like parsers in C
+-
+- Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc.
+-
++
++ Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
++
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+-
++
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+-
++
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+@@ -26,93 +26,80 @@
+ special exception, which will cause the skeleton and the resulting
+ Bison output files to be licensed under the GNU General Public
+ License without this special exception.
+-
++
+ This special exception was added by the Free Software Foundation in
+ version 2.2 of Bison. */
+
+-#ifndef YY_YY_SCRIPTS_GENKSYMS_PARSE_TAB_H_SHIPPED_INCLUDED
+-# define YY_YY_SCRIPTS_GENKSYMS_PARSE_TAB_H_SHIPPED_INCLUDED
+-/* Enabling traces. */
++#ifndef YY_YY_PARSE_TAB_H_INCLUDED
++# define YY_YY_PARSE_TAB_H_INCLUDED
++/* Debug traces. */
+ #ifndef YYDEBUG
+-# define YYDEBUG 1
++# define YYDEBUG 0
+ #endif
+ #if YYDEBUG
+ extern int yydebug;
+ #endif
+
+-/* Tokens. */
++/* Token type. */
+ #ifndef YYTOKENTYPE
+ # define YYTOKENTYPE
+- /* Put the tokens into the symbol table, so that GDB and other debuggers
+- know about them. */
+- enum yytokentype {
+- ASM_KEYW = 258,
+- ATTRIBUTE_KEYW = 259,
+- AUTO_KEYW = 260,
+- BOOL_KEYW = 261,
+- CHAR_KEYW = 262,
+- CONST_KEYW = 263,
+- DOUBLE_KEYW = 264,
+- ENUM_KEYW = 265,
+- EXTERN_KEYW = 266,
+- EXTENSION_KEYW = 267,
+- FLOAT_KEYW = 268,
+- INLINE_KEYW = 269,
+- INT_KEYW = 270,
+- LONG_KEYW = 271,
+- REGISTER_KEYW = 272,
+- RESTRICT_KEYW = 273,
+- SHORT_KEYW = 274,
+- SIGNED_KEYW = 275,
+- STATIC_KEYW = 276,
+- STRUCT_KEYW = 277,
+- TYPEDEF_KEYW = 278,
+- UNION_KEYW = 279,
+- UNSIGNED_KEYW = 280,
+- VOID_KEYW = 281,
+- VOLATILE_KEYW = 282,
+- TYPEOF_KEYW = 283,
+- EXPORT_SYMBOL_KEYW = 284,
+- ASM_PHRASE = 285,
+- ATTRIBUTE_PHRASE = 286,
+- TYPEOF_PHRASE = 287,
+- BRACE_PHRASE = 288,
+- BRACKET_PHRASE = 289,
+- EXPRESSION_PHRASE = 290,
+- CHAR = 291,
+- DOTS = 292,
+- IDENT = 293,
+- INT = 294,
+- REAL = 295,
+- STRING = 296,
+- TYPE = 297,
+- OTHER = 298,
+- FILENAME = 299
+- };
++ enum yytokentype
++ {
++ ASM_KEYW = 258,
++ ATTRIBUTE_KEYW = 259,
++ AUTO_KEYW = 260,
++ BOOL_KEYW = 261,
++ CHAR_KEYW = 262,
++ CONST_KEYW = 263,
++ DOUBLE_KEYW = 264,
++ ENUM_KEYW = 265,
++ EXTERN_KEYW = 266,
++ EXTENSION_KEYW = 267,
++ FLOAT_KEYW = 268,
++ INLINE_KEYW = 269,
++ INT_KEYW = 270,
++ LONG_KEYW = 271,
++ REGISTER_KEYW = 272,
++ RESTRICT_KEYW = 273,
++ SHORT_KEYW = 274,
++ SIGNED_KEYW = 275,
++ STATIC_KEYW = 276,
++ STRUCT_KEYW = 277,
++ TYPEDEF_KEYW = 278,
++ UNION_KEYW = 279,
++ UNSIGNED_KEYW = 280,
++ VOID_KEYW = 281,
++ VOLATILE_KEYW = 282,
++ TYPEOF_KEYW = 283,
++ EXPORT_SYMBOL_KEYW = 284,
++ ASM_PHRASE = 285,
++ ATTRIBUTE_PHRASE = 286,
++ TYPEOF_PHRASE = 287,
++ BRACE_PHRASE = 288,
++ BRACKET_PHRASE = 289,
++ EXPRESSION_PHRASE = 290,
++ CHAR = 291,
++ DOTS = 292,
++ IDENT = 293,
++ INT = 294,
++ REAL = 295,
++ STRING = 296,
++ TYPE = 297,
++ OTHER = 298,
++ FILENAME = 299
++ };
+ #endif
+
+-
++/* Value type. */
+ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
+ typedef int YYSTYPE;
+ # define YYSTYPE_IS_TRIVIAL 1
+-# define yystype YYSTYPE /* obsolescent; will be withdrawn */
+ # define YYSTYPE_IS_DECLARED 1
+ #endif
+
++
+ extern YYSTYPE yylval;
+
+-#ifdef YYPARSE_PARAM
+-#if defined __STDC__ || defined __cplusplus
+-int yyparse (void *YYPARSE_PARAM);
+-#else
+-int yyparse ();
+-#endif
+-#else /* ! YYPARSE_PARAM */
+-#if defined __STDC__ || defined __cplusplus
+ int yyparse (void);
+-#else
+-int yyparse ();
+-#endif
+-#endif /* ! YYPARSE_PARAM */
+
+-#endif /* !YY_YY_SCRIPTS_GENKSYMS_PARSE_TAB_H_SHIPPED_INCLUDED */
++#endif /* !YY_YY_PARSE_TAB_H_INCLUDED */
+--- a/scripts/genksyms/parse.y
++++ b/scripts/genksyms/parse.y
+@@ -320,8 +320,6 @@ direct_declarator:
+ { $$ = $2; }
+ | '(' declarator ')'
+ { $$ = $3; }
+- | '(' error ')'
+- { $$ = $3; }
+ ;
+
+ /* Nested declarators differ from regular declarators in that they do
--- /dev/null
+From fa6317eedd6341f2144ed1097706d8c34f18b6e4 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Tue, 26 Jan 2016 12:10:01 -0200
+Subject: [media] go7007: add MEDIA_CAMERA_SUPPORT dependency
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit fa6317eedd6341f2144ed1097706d8c34f18b6e4 upstream.
+
+If MEDIA_SUBDRV_AUTOSELECT and VIDEO_GO7007 are both set, we
+automatically select VIDEO_OV7640, but that depends on MEDIA_CAMERA_SUPPORT,
+so we get a Kconfig warning if that is disabled:
+
+warning: (VIDEO_GO7007) selects VIDEO_OV7640 which has unmet direct dependencies (MEDIA_SUPPORT && I2C && VIDEO_V4L2 && MEDIA_CAMERA_SUPPORT)
+
+This adds another dependency so we don't accidentally select
+it when it is unavailable.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/media/usb/go7007/Kconfig | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/media/usb/go7007/Kconfig
++++ b/drivers/media/usb/go7007/Kconfig
+@@ -11,7 +11,7 @@ config VIDEO_GO7007
+ select VIDEO_TW2804 if MEDIA_SUBDRV_AUTOSELECT
+ select VIDEO_TW9903 if MEDIA_SUBDRV_AUTOSELECT
+ select VIDEO_TW9906 if MEDIA_SUBDRV_AUTOSELECT
+- select VIDEO_OV7640 if MEDIA_SUBDRV_AUTOSELECT
++ select VIDEO_OV7640 if MEDIA_SUBDRV_AUTOSELECT && MEDIA_CAMERA_SUPPORT
+ select VIDEO_UDA1342 if MEDIA_SUBDRV_AUTOSELECT
+ ---help---
+ This is a video4linux driver for the WIS GO7007 MPEG
--- /dev/null
+From fbc2a294f29e726787a0f5238b27137904f26b81 Mon Sep 17 00:00:00 2001
+From: Augusto Mecking Caringi <augustocaringi@gmail.com>
+Date: Mon, 16 Jan 2017 14:30:41 +0000
+Subject: gpio: intel-mid: Fix build warning when !CONFIG_PM
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Augusto Mecking Caringi <augustocaringi@gmail.com>
+
+commit fbc2a294f29e726787a0f5238b27137904f26b81 upstream.
+
+The only usage of function intel_gpio_runtime_idle() is here (in the
+same file):
+
+static const struct dev_pm_ops intel_gpio_pm_ops = {
+ SET_RUNTIME_PM_OPS(NULL, NULL, intel_gpio_runtime_idle)
+};
+
+And when CONFIG_PM is not set, the macro SET_RUNTIME_PM_OPS expands to
+nothing, causing the following compiler warning:
+
+drivers/gpio/gpio-intel-mid.c:324:12: warning: ‘intel_gpio_runtime_idle’
+defined but not used [-Wunused-function]
+static int intel_gpio_runtime_idle(struct device *dev)
+
+Fix it by annotating the function with __maybe_unused.
+
+Signed-off-by: Augusto Mecking Caringi <augustocaringi@gmail.com>
+Acked-by: Andy Shevchenko <andy.shevchenko@gmail.com>
+Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/gpio/gpio-intel-mid.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/gpio/gpio-intel-mid.c
++++ b/drivers/gpio/gpio-intel-mid.c
+@@ -326,7 +326,7 @@ static void intel_mid_irq_init_hw(struct
+ }
+ }
+
+-static int intel_gpio_runtime_idle(struct device *dev)
++static int __maybe_unused intel_gpio_runtime_idle(struct device *dev)
+ {
+ int err = pm_schedule_suspend(dev, 500);
+ return err ?: -EBUSY;
--- /dev/null
+From b115bebc07f282067eccc06fd5aa3060ab1426da Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Fri, 17 Feb 2017 16:13:44 +0100
+Subject: gpio: xgene: mark PM functions as __maybe_unused
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit b115bebc07f282067eccc06fd5aa3060ab1426da upstream.
+
+When CONFIG_PM_SLEEP is disabled, we get a warning about unused functions:
+
+drivers/gpio/gpio-xgene.c:155:12: warning: 'xgene_gpio_resume' defined but not used [-Wunused-function]
+ static int xgene_gpio_resume(struct device *dev)
+ ^~~~~~~~~~~~~~~~~
+drivers/gpio/gpio-xgene.c:142:12: warning: 'xgene_gpio_suspend' defined but not used [-Wunused-function]
+ static int xgene_gpio_suspend(struct device *dev)
+
+The warnings are harmless and can be avoided by simplifying the code and marking
+the functions as __maybe_unused.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/gpio/gpio-xgene.c | 13 +++----------
+ 1 file changed, 3 insertions(+), 10 deletions(-)
+
+--- a/drivers/gpio/gpio-xgene.c
++++ b/drivers/gpio/gpio-xgene.c
+@@ -42,9 +42,7 @@ struct xgene_gpio {
+ struct gpio_chip chip;
+ void __iomem *base;
+ spinlock_t lock;
+-#ifdef CONFIG_PM
+ u32 set_dr_val[XGENE_MAX_GPIO_BANKS];
+-#endif
+ };
+
+ static inline struct xgene_gpio *to_xgene_gpio(struct gpio_chip *chip)
+@@ -132,8 +130,7 @@ static int xgene_gpio_dir_out(struct gpi
+ return 0;
+ }
+
+-#ifdef CONFIG_PM
+-static int xgene_gpio_suspend(struct device *dev)
++static __maybe_unused int xgene_gpio_suspend(struct device *dev)
+ {
+ struct xgene_gpio *gpio = dev_get_drvdata(dev);
+ unsigned long bank_offset;
+@@ -146,7 +143,7 @@ static int xgene_gpio_suspend(struct dev
+ return 0;
+ }
+
+-static int xgene_gpio_resume(struct device *dev)
++static __maybe_unused int xgene_gpio_resume(struct device *dev)
+ {
+ struct xgene_gpio *gpio = dev_get_drvdata(dev);
+ unsigned long bank_offset;
+@@ -160,10 +157,6 @@ static int xgene_gpio_resume(struct devi
+ }
+
+ static SIMPLE_DEV_PM_OPS(xgene_gpio_pm, xgene_gpio_suspend, xgene_gpio_resume);
+-#define XGENE_GPIO_PM_OPS (&xgene_gpio_pm)
+-#else
+-#define XGENE_GPIO_PM_OPS NULL
+-#endif
+
+ static int xgene_gpio_probe(struct platform_device *pdev)
+ {
+@@ -230,7 +223,7 @@ static struct platform_driver xgene_gpio
+ .driver = {
+ .name = "xgene-gpio",
+ .of_match_table = xgene_gpio_of_match,
+- .pm = XGENE_GPIO_PM_OPS,
++ .pm = &xgene_gpio_pm,
+ },
+ .probe = xgene_gpio_probe,
+ .remove = xgene_gpio_remove,
--- /dev/null
+From b97baa3e22e18dac42001e665cf27ad1211bf878 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Tue, 26 Jan 2016 12:09:56 -0200
+Subject: [media] hdpvr: hide unused variable
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit b97baa3e22e18dac42001e665cf27ad1211bf878 upstream.
+
+The i2c client pointer is only used when CONFIG_I2C is set, and
+otherwise produces a compile-time warning:
+
+drivers/media/usb/hdpvr/hdpvr-core.c: In function 'hdpvr_probe':
+drivers/media/usb/hdpvr/hdpvr-core.c:276:21: error: unused variable 'client' [-Werror=unused-variable]
+
+This uses the same #ifdef to hide the variable when the code using
+it is hidden.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/media/usb/hdpvr/hdpvr-core.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/drivers/media/usb/hdpvr/hdpvr-core.c
++++ b/drivers/media/usb/hdpvr/hdpvr-core.c
+@@ -273,7 +273,9 @@ static int hdpvr_probe(struct usb_interf
+ struct hdpvr_device *dev;
+ struct usb_host_interface *iface_desc;
+ struct usb_endpoint_descriptor *endpoint;
++#if IS_ENABLED(CONFIG_I2C)
+ struct i2c_client *client;
++#endif
+ size_t buffer_size;
+ int i;
+ int retval = -ENOMEM;
--- /dev/null
+From b93f342da1766ef1740e6277508329356c4ea48b Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Wed, 2 Mar 2016 16:58:59 +0100
+Subject: hwrng: exynos - use __maybe_unused to hide pm functions
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit b93f342da1766ef1740e6277508329356c4ea48b upstream.
+
+The exynos random driver uses #ifdef to check for CONFIG_PM, but
+then uses SIMPLE_DEV_PM_OPS, which leaves the references out when
+CONFIG_PM_SLEEP is not defined, so we get a warning with
+PM=y && PM_SLEEP=n:
+
+drivers/char/hw_random/exynos-rng.c:166:12: error: 'exynos_rng_suspend' defined but not used [-Werror=unused-function]
+drivers/char/hw_random/exynos-rng.c:171:12: error: 'exynos_rng_resume' defined but not used [-Werror=unused-function]
+
+This removes the incorrect #ifdef and instead uses a __maybe_unused
+annotation to let the compiler know it can silently drop
+the function definition.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
+Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/char/hw_random/exynos-rng.c | 10 ++++------
+ 1 file changed, 4 insertions(+), 6 deletions(-)
+
+--- a/drivers/char/hw_random/exynos-rng.c
++++ b/drivers/char/hw_random/exynos-rng.c
+@@ -155,8 +155,7 @@ static int exynos_rng_probe(struct platf
+ return ret;
+ }
+
+-#ifdef CONFIG_PM
+-static int exynos_rng_runtime_suspend(struct device *dev)
++static int __maybe_unused exynos_rng_runtime_suspend(struct device *dev)
+ {
+ struct platform_device *pdev = to_platform_device(dev);
+ struct exynos_rng *exynos_rng = platform_get_drvdata(pdev);
+@@ -166,7 +165,7 @@ static int exynos_rng_runtime_suspend(st
+ return 0;
+ }
+
+-static int exynos_rng_runtime_resume(struct device *dev)
++static int __maybe_unused exynos_rng_runtime_resume(struct device *dev)
+ {
+ struct platform_device *pdev = to_platform_device(dev);
+ struct exynos_rng *exynos_rng = platform_get_drvdata(pdev);
+@@ -174,12 +173,12 @@ static int exynos_rng_runtime_resume(str
+ return clk_prepare_enable(exynos_rng->clk);
+ }
+
+-static int exynos_rng_suspend(struct device *dev)
++static int __maybe_unused exynos_rng_suspend(struct device *dev)
+ {
+ return pm_runtime_force_suspend(dev);
+ }
+
+-static int exynos_rng_resume(struct device *dev)
++static int __maybe_unused exynos_rng_resume(struct device *dev)
+ {
+ struct platform_device *pdev = to_platform_device(dev);
+ struct exynos_rng *exynos_rng = platform_get_drvdata(pdev);
+@@ -191,7 +190,6 @@ static int exynos_rng_resume(struct devi
+
+ return exynos_rng_configure(exynos_rng);
+ }
+-#endif
+
+ static const struct dev_pm_ops exynos_rng_pm_ops = {
+ SET_SYSTEM_SLEEP_PM_OPS(exynos_rng_suspend, exynos_rng_resume)
--- /dev/null
+From 5abe9b26847c65a698f38744a52635b287514294 Mon Sep 17 00:00:00 2001
+From: "Luis R. Rodriguez" <mcgrof@kernel.org>
+Date: Tue, 7 Jun 2016 16:52:27 -0700
+Subject: i2c: remove __init from i2c_register_board_info()
+
+From: Luis R. Rodriguez <mcgrof@kernel.org>
+
+commit 5abe9b26847c65a698f38744a52635b287514294 upstream.
+
+As of next-20160607 with allyesconfig we get this linker failure:
+
+ MODPOST vmlinux.o
+WARNING: vmlinux.o(.text+0x21bc0d): Section mismatch in reference from
+the function intel_scu_devices_create() to the function
+.init.text:i2c_register_board_info()
+
+This is caused by the fact that intel_scu_devices_create() calls
+i2c_register_board_info() and intel_scu_devices_create() is not
+annotated with __init. This typically involves manual code
+inspection and if one is certain this is correct we would
+just peg intel_scu_devices_create() with a __ref annotation.
+
+In this case this would be wrong though as the
+intel_scu_devices_create() call is exported, and used in
+the ipc_probe() on drivers/platform/x86/intel_scu_ipc.c.
+The issue is that even though builtin_pci_driver(ipc_driver)
+is used this just exposes the probe routine, which can occur
+at any point in time if this bus supports hotplug. A race
+can happen between kernel_init_freeable() that calls the init
+calls (in this case registeres the intel_scu_ipc.c driver, and
+later free_initmem(), which would free the i2c_register_board_info().
+If a probe happens later in boot i2c_register_board_info() would
+not be present and we should get a page fault.
+
+Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
+[wsa: made function declaration a one-liner]
+Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/i2c/i2c-boardinfo.c | 4 +---
+ 1 file changed, 1 insertion(+), 3 deletions(-)
+
+--- a/drivers/i2c/i2c-boardinfo.c
++++ b/drivers/i2c/i2c-boardinfo.c
+@@ -56,9 +56,7 @@ EXPORT_SYMBOL_GPL(__i2c_first_dynamic_bu
+ * The board info passed can safely be __initdata, but be careful of embedded
+ * pointers (for platform_data, functions, etc) since that won't be copied.
+ */
+-int __init
+-i2c_register_board_info(int busnum,
+- struct i2c_board_info const *info, unsigned len)
++int i2c_register_board_info(int busnum, struct i2c_board_info const *info, unsigned len)
+ {
+ int status;
+
--- /dev/null
+From foo@baz Fri Feb 23 17:12:49 CET 2018
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Tue, 20 Feb 2018 12:54:53 +0100
+Subject: idle: i7300: add PCI dependency
+To: stable@vger.kernel.org
+Cc: Greg KH <gregkh@linuxfoundation.org>, linux-kernel@vger.kernel.org, Arnd Bergmann <arnd@arndb.de>
+Message-ID: <20180220115527.1806578-7-arnd@arndb.de>
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+GCC correctly points out an uninitialized variable use when CONFIG_PCI is disabled.
+
+drivers/idle/i7300_idle.c: In function 'i7300_idle_notifier':
+include/asm-generic/bug.h:119:5: error: 'got_ctl' may be used uninitialized in this function [-Werror=maybe-uninitialized]
+ if (unlikely(__ret_warn_once && !__warned)) { \
+ ^
+drivers/idle/i7300_idle.c:415:5: note: 'got_ctl' was declared here
+ u8 got_ctl;
+ ^~~~~~~
+
+The driver no longer exists in later kernels, so this patch only appplies to
+linux-4.9.y and earlier.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/idle/Kconfig | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/idle/Kconfig
++++ b/drivers/idle/Kconfig
+@@ -17,6 +17,7 @@ config I7300_IDLE_IOAT_CHANNEL
+
+ config I7300_IDLE
+ tristate "Intel chipset idle memory power saving driver"
++ depends on PCI
+ select I7300_IDLE_IOAT_CHANNEL
+ help
+ Enable memory power savings when idle with certain Intel server
--- /dev/null
+From 7ca6574a7afb669b0b4b30dd63adeb310e97e250 Mon Sep 17 00:00:00 2001
+From: Colin Ian King <colin.king@canonical.com>
+Date: Fri, 22 Jan 2016 17:49:22 +0000
+Subject: iio: adc: axp288: remove redundant duplicate const on axp288_adc_channels
+
+From: Colin Ian King <colin.king@canonical.com>
+
+commit 7ca6574a7afb669b0b4b30dd63adeb310e97e250 upstream.
+
+duplicate const can be removed, it is redundant. Found by static
+analysis using smatch.
+
+Signed-off-by: Colin Ian King <colin.king@canonical.com>
+Signed-off-by: Jonathan Cameron <jic23@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/iio/adc/axp288_adc.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/iio/adc/axp288_adc.c
++++ b/drivers/iio/adc/axp288_adc.c
+@@ -44,7 +44,7 @@ struct axp288_adc_info {
+ struct regmap *regmap;
+ };
+
+-static const struct iio_chan_spec const axp288_adc_channels[] = {
++static const struct iio_chan_spec axp288_adc_channels[] = {
+ {
+ .indexed = 1,
+ .type = IIO_TEMP,
--- /dev/null
+From 3021376d6d12dd1be8a0a13c16dae8badb7766fd Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Mon, 1 Feb 2016 17:42:02 +0100
+Subject: infiniband: cxgb4: use %pR format string for printing resources
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit 3021376d6d12dd1be8a0a13c16dae8badb7766fd upstream.
+
+The cxgb4 prints an MMIO resource using the "0x%x" and "%p" format
+strings on the length and start, respective, but that
+triggers a compiler warning when using a 64-bit resource_size_t
+on a 32-bit architecture:
+
+drivers/infiniband/hw/cxgb4/device.c: In function 'c4iw_rdev_open':
+drivers/infiniband/hw/cxgb4/device.c:807:7: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
+ (void *)pci_resource_start(rdev->lldi.pdev, 2),
+
+This changes the format string to use %pR instead, which pretty-prints
+the resource, avoids the warning and is shorter.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Acked-by: Steve Wise <swise@opengridcomputing.com>
+Signed-off-by: Doug Ledford <dledford@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/infiniband/hw/cxgb4/device.c | 5 ++---
+ 1 file changed, 2 insertions(+), 3 deletions(-)
+
+--- a/drivers/infiniband/hw/cxgb4/device.c
++++ b/drivers/infiniband/hw/cxgb4/device.c
+@@ -809,10 +809,9 @@ static int c4iw_rdev_open(struct c4iw_rd
+ rdev->lldi.vr->qp.size,
+ rdev->lldi.vr->cq.start,
+ rdev->lldi.vr->cq.size);
+- PDBG("udb len 0x%x udb base %p db_reg %p gts_reg %p "
++ PDBG("udb %pR db_reg %p gts_reg %p "
+ "qpmask 0x%x cqmask 0x%x\n",
+- (unsigned)pci_resource_len(rdev->lldi.pdev, 2),
+- (void *)pci_resource_start(rdev->lldi.pdev, 2),
++ &rdev->lldi.pdev->resource[2],
+ rdev->lldi.db_reg, rdev->lldi.gts_reg,
+ rdev->qpmask, rdev->cqmask);
+
--- /dev/null
+From ea4348c8462a20e8b1b6455a7145d2b86f8a49b6 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Wed, 26 Oct 2016 15:55:02 -0700
+Subject: Input: tca8418_keypad - hide gcc-4.9 -Wmaybe-uninitialized warning
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit ea4348c8462a20e8b1b6455a7145d2b86f8a49b6 upstream.
+
+Older versions of gcc warn about the tca8418_irq_handler function
+as they can't keep track of the variable assignment inside of the
+loop when using the -Wmaybe-unintialized flag:
+
+drivers/input/keyboard/tca8418_keypad.c: In function ‘tca8418_irq_handler’:
+drivers/input/keyboard/tca8418_keypad.c:172:9: error: ‘reg’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
+drivers/input/keyboard/tca8418_keypad.c:165:5: note: ‘reg’ was declared here
+
+This is fixed in gcc-6, but it's possible to rearrange the code
+in a way that avoids the warning on older compilers as well.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/input/keyboard/tca8418_keypad.c | 21 ++++++++++++---------
+ 1 file changed, 12 insertions(+), 9 deletions(-)
+
+--- a/drivers/input/keyboard/tca8418_keypad.c
++++ b/drivers/input/keyboard/tca8418_keypad.c
+@@ -164,11 +164,18 @@ static void tca8418_read_keypad(struct t
+ int error, col, row;
+ u8 reg, state, code;
+
+- /* Initial read of the key event FIFO */
+- error = tca8418_read_byte(keypad_data, REG_KEY_EVENT_A, ®);
++ do {
++ error = tca8418_read_byte(keypad_data, REG_KEY_EVENT_A, ®);
++ if (error < 0) {
++ dev_err(&keypad_data->client->dev,
++ "unable to read REG_KEY_EVENT_A\n");
++ break;
++ }
++
++ /* Assume that key code 0 signifies empty FIFO */
++ if (reg <= 0)
++ break;
+
+- /* Assume that key code 0 signifies empty FIFO */
+- while (error >= 0 && reg > 0) {
+ state = reg & KEY_EVENT_VALUE;
+ code = reg & KEY_EVENT_CODE;
+
+@@ -184,11 +191,7 @@ static void tca8418_read_keypad(struct t
+
+ /* Read for next loop */
+ error = tca8418_read_byte(keypad_data, REG_KEY_EVENT_A, ®);
+- }
+-
+- if (error < 0)
+- dev_err(&keypad_data->client->dev,
+- "unable to read REG_KEY_EVENT_A\n");
++ } while (1);
+
+ input_sync(input);
+ }
--- /dev/null
+From 52b79e2bdf92b07b37c805c50811eaf69a33683d Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Thu, 28 Jan 2016 17:39:24 +0100
+Subject: ipv4: ipconfig: avoid unused ic_proto_used symbol
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit 52b79e2bdf92b07b37c805c50811eaf69a33683d upstream.
+
+When CONFIG_PROC_FS, CONFIG_IP_PNP_BOOTP, CONFIG_IP_PNP_DHCP and
+CONFIG_IP_PNP_RARP are all disabled, we get a warning about the
+ic_proto_used variable being unused:
+
+net/ipv4/ipconfig.c:146:12: error: 'ic_proto_used' defined but not used [-Werror=unused-variable]
+
+This avoids the warning, by making the definition conditional on
+whether a dynamic IP configuration protocol is configured. If not,
+we know that the value is always zero, so we can optimize away the
+variable and all code that depends on it.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ net/ipv4/ipconfig.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+--- a/net/ipv4/ipconfig.c
++++ b/net/ipv4/ipconfig.c
+@@ -152,7 +152,11 @@ static char dhcp_client_identifier[253]
+
+ /* Persistent data: */
+
++#ifdef IPCONFIG_DYNAMIC
+ static int ic_proto_used; /* Protocol used, if any */
++#else
++#define ic_proto_used 0
++#endif
+ static __be32 ic_nameservers[CONF_NAMESERVERS_MAX]; /* DNS Server IP addresses */
+ static u8 ic_domain[64]; /* DNS (not NIS) domain name */
+
--- /dev/null
+From 27d807180ae0a9e50d90adf9b22573c21be904c2 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Wed, 25 Jan 2017 23:15:53 +0100
+Subject: ISDN: eicon: reduce stack size of sig_ind function
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit 27d807180ae0a9e50d90adf9b22573c21be904c2 upstream.
+
+I noticed that this function uses a lot of kernel stack when the
+"latent entropy" plugin is enabled:
+
+drivers/isdn/hardware/eicon/message.c: In function 'sig_ind':
+drivers/isdn/hardware/eicon/message.c:6113:1: error: the frame size of 1168 bytes is larger than 1152 bytes [-Werror=frame-larger-than=]
+
+We currently don't warn about this, as we raise the warning limit
+to 2048 bytes in mainline, but I'd like to lower that limit again
+in the future, and this function can easily be changed to be more
+efficient and avoid that warning, by making some of its local
+variables 'const'.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/isdn/hardware/eicon/message.c | 16 ++++++++--------
+ 1 file changed, 8 insertions(+), 8 deletions(-)
+
+--- a/drivers/isdn/hardware/eicon/message.c
++++ b/drivers/isdn/hardware/eicon/message.c
+@@ -147,7 +147,7 @@ static word plci_remove_check(PLCI *);
+ static void listen_check(DIVA_CAPI_ADAPTER *);
+ static byte AddInfo(byte **, byte **, byte *, byte *);
+ static byte getChannel(API_PARSE *);
+-static void IndParse(PLCI *, word *, byte **, byte);
++static void IndParse(PLCI *, const word *, byte **, byte);
+ static byte ie_compare(byte *, byte *);
+ static word find_cip(DIVA_CAPI_ADAPTER *, byte *, byte *);
+ static word CPN_filter_ok(byte *cpn, DIVA_CAPI_ADAPTER *, word);
+@@ -4860,7 +4860,7 @@ static void sig_ind(PLCI *plci)
+ /* included before the ESC_MSGTYPE and MAXPARMSIDS has to be incremented */
+ /* SMSG is situated at the end because its 0 (for compatibility reasons */
+ /* (see Info_Mask Bit 4, first IE. then the message type) */
+- word parms_id[] =
++ static const word parms_id[] =
+ {MAXPARMSIDS, CPN, 0xff, DSA, OSA, BC, LLC, HLC, ESC_CAUSE, DSP, DT, CHA,
+ UUI, CONG_RR, CONG_RNR, ESC_CHI, KEY, CHI, CAU, ESC_LAW,
+ RDN, RDX, CONN_NR, RIN, NI, CAI, ESC_CR,
+@@ -4868,12 +4868,12 @@ static void sig_ind(PLCI *plci)
+ /* 14 FTY repl by ESC_CHI */
+ /* 18 PI repl by ESC_LAW */
+ /* removed OAD changed to 0xff for future use, OAD is multiIE now */
+- word multi_fac_id[] = {1, FTY};
+- word multi_pi_id[] = {1, PI};
+- word multi_CiPN_id[] = {1, OAD};
+- word multi_ssext_id[] = {1, ESC_SSEXT};
++ static const word multi_fac_id[] = {1, FTY};
++ static const word multi_pi_id[] = {1, PI};
++ static const word multi_CiPN_id[] = {1, OAD};
++ static const word multi_ssext_id[] = {1, ESC_SSEXT};
+
+- word multi_vswitch_id[] = {1, ESC_VSWITCH};
++ static const word multi_vswitch_id[] = {1, ESC_VSWITCH};
+
+ byte *cau;
+ word ncci;
+@@ -8926,7 +8926,7 @@ static void listen_check(DIVA_CAPI_ADAPT
+ /* functions for all parameters sent in INDs */
+ /*------------------------------------------------------------------*/
+
+-static void IndParse(PLCI *plci, word *parms_id, byte **parms, byte multiIEsize)
++static void IndParse(PLCI *plci, const word *parms_id, byte **parms, byte multiIEsize)
+ {
+ word ploc; /* points to current location within packet */
+ byte w;
--- /dev/null
+From 01ed1e1504ac83a8b0b365c9f55d3427babbd7d9 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Wed, 2 Mar 2016 20:06:45 +0100
+Subject: isdn: icn: remove a #warning
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit 01ed1e1504ac83a8b0b365c9f55d3427babbd7d9 upstream.
+
+The icn driver currently produces an unconditional #warning whenever
+we build it, introduced by Karsten Keil back in 2003:
+
+ #warning TODO test headroom or use skb->nb to flag ACK
+
+Karsten's original commit (from BitKeeper) contains this description:
+
+ - here are lot of bugs left, so ISDN is not stable yet but
+ I think it's really time to fix it, even if it need some cycles
+ to get it right (normally I'm only send patches if it works 100% for
+ me).
+ - I add some additional #warnings to address places which need fixing
+ (I hope that some of the other ISDN developer jump in)
+
+Apparently this has not happened, and it is unlikely that it ever will,
+given that the driver doesn't seem to work. No substantial bug fixes
+other than janitorial cleanups have happened in the driver since then,
+and I see no indication that anyone who patched it had the hardware.
+
+We should probably either remove the driver, or remove all of i4l,
+but for now, this shuts up the distracting #warning by turning it
+into a comment.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Link: http://git.meleeweb.net/linux.git/commit/?id=b0deac0886b0056765afd149e9834373b38e096b
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/isdn/icn/icn.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/isdn/icn/icn.c
++++ b/drivers/isdn/icn/icn.c
+@@ -718,7 +718,7 @@ icn_sendbuf(int channel, int ack, struct
+ return 0;
+ if (card->sndcount[channel] > ICN_MAX_SQUEUE)
+ return 0;
+-#warning TODO test headroom or use skb->nb to flag ACK
++ /* TODO test headroom or use skb->nb to flag ACK */
+ nskb = skb_clone(skb, GFP_ATOMIC);
+ if (nskb) {
+ /* Push ACK flag as one
--- /dev/null
+From foo@baz Fri Feb 23 17:12:49 CET 2018
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Tue, 20 Feb 2018 12:54:51 +0100
+Subject: isdn: sc: work around type mismatch warning
+To: stable@vger.kernel.org
+Cc: Greg KH <gregkh@linuxfoundation.org>, linux-kernel@vger.kernel.org, Arnd Bergmann <arnd@arndb.de>, Karsten Keil <isdn@linux-pingi.de>, netdev@vger.kernel.org
+Message-ID: <20180220115527.1806578-5-arnd@arndb.de>
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+This driver shows warnings on many architectures:
+
+drivers/isdn/sc/init.c: In function 'identify_board':
+drivers/isdn/sc/init.c:484:2: error: passing argument 1 of 'readl' makes pointer from integer without a cast [-Werror]
+
+In newer kernels, it was completely removed, but for the 4.4-stable
+series, let's just shut up that warning by adding an extra variable
+to do the necessary type cast.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/isdn/sc/init.c | 7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
+--- a/drivers/isdn/sc/init.c
++++ b/drivers/isdn/sc/init.c
+@@ -441,6 +441,7 @@ static int identify_board(unsigned long
+ RspMessage rcvmsg;
+ ReqMessage sndmsg;
+ HWConfig_pl hwci;
++ void __iomem *rambase_sig = (void __iomem *)rambase + SIG_OFFSET;
+ int x;
+
+ pr_debug("Attempting to identify adapter @ 0x%lx io 0x%x\n",
+@@ -481,7 +482,7 @@ static int identify_board(unsigned long
+ */
+ outb(PRI_BASEPG_VAL, pgport);
+ msleep_interruptible(1000);
+- sig = readl(rambase + SIG_OFFSET);
++ sig = readl(rambase_sig);
+ pr_debug("Looking for a signature, got 0x%lx\n", sig);
+ if (sig == SIGNATURE)
+ return PRI_BOARD;
+@@ -491,7 +492,7 @@ static int identify_board(unsigned long
+ */
+ outb(BRI_BASEPG_VAL, pgport);
+ msleep_interruptible(1000);
+- sig = readl(rambase + SIG_OFFSET);
++ sig = readl(rambase_sig);
+ pr_debug("Looking for a signature, got 0x%lx\n", sig);
+ if (sig == SIGNATURE)
+ return BRI_BOARD;
+@@ -501,7 +502,7 @@ static int identify_board(unsigned long
+ /*
+ * Try to spot a card
+ */
+- sig = readl(rambase + SIG_OFFSET);
++ sig = readl(rambase_sig);
+ pr_debug("Looking for a signature, got 0x%lx\n", sig);
+ if (sig != SIGNATURE)
+ return -1;
--- /dev/null
+From foo@baz Fri Feb 23 17:12:49 CET 2018
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Tue, 20 Feb 2018 12:55:09 +0100
+Subject: kasan: rework Kconfig settings
+To: stable@vger.kernel.org
+Cc: Greg KH <gregkh@linuxfoundation.org>, linux-kernel@vger.kernel.org, Arnd Bergmann <arnd@arndb.de>, Mauro Carvalho Chehab <mchehab@kernel.org>, Andrey Ryabinin <aryabinin@virtuozzo.com>, Alexander Potapenko <glider@google.com>, Dmitry Vyukov <dvyukov@google.com>, Andrey Konovalov <andreyknvl@google.com>, Andrew Morton <akpm@linux-foundation.org>, Linus Torvalds <torvalds@linux-foundation.org>, Sudip Mukherjee <sudipm.mukherjee@gmail.com>, Sasha Levin <alexander.levin@verizon.com>
+Message-ID: <20180220115527.1806578-23-arnd@arndb.de>
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit e7c52b84fb18f08ce49b6067ae6285aca79084a8 upstream.
+
+We get a lot of very large stack frames using gcc-7.0.1 with the default
+-fsanitize-address-use-after-scope --param asan-stack=1 options, which can
+easily cause an overflow of the kernel stack, e.g.
+
+ drivers/gpu/drm/i915/gvt/handlers.c:2434:1: warning: the frame size of 46176 bytes is larger than 3072 bytes
+ drivers/net/wireless/ralink/rt2x00/rt2800lib.c:5650:1: warning: the frame size of 23632 bytes is larger than 3072 bytes
+ lib/atomic64_test.c:250:1: warning: the frame size of 11200 bytes is larger than 3072 bytes
+ drivers/gpu/drm/i915/gvt/handlers.c:2621:1: warning: the frame size of 9208 bytes is larger than 3072 bytes
+ drivers/media/dvb-frontends/stv090x.c:3431:1: warning: the frame size of 6816 bytes is larger than 3072 bytes
+ fs/fscache/stats.c:287:1: warning: the frame size of 6536 bytes is larger than 3072 bytes
+
+To reduce this risk, -fsanitize-address-use-after-scope is now split out
+into a separate CONFIG_KASAN_EXTRA Kconfig option, leading to stack
+frames that are smaller than 2 kilobytes most of the time on x86_64. An
+earlier version of this patch also prevented combining KASAN_EXTRA with
+KASAN_INLINE, but that is no longer necessary with gcc-7.0.1.
+
+All patches to get the frame size below 2048 bytes with CONFIG_KASAN=y
+and CONFIG_KASAN_EXTRA=n have been merged by maintainers now, so we can
+bring back that default now. KASAN_EXTRA=y still causes lots of
+warnings but now defaults to !COMPILE_TEST to disable it in
+allmodconfig, and it remains disabled in all other defconfigs since it
+is a new option. I arbitrarily raise the warning limit for KASAN_EXTRA
+to 3072 to reduce the noise, but an allmodconfig kernel still has around
+50 warnings on gcc-7.
+
+I experimented a bit more with smaller stack frames and have another
+follow-up series that reduces the warning limit for 64-bit architectures
+to 1280 bytes (without CONFIG_KASAN).
+
+With earlier versions of this patch series, I also had patches to address
+the warnings we get with KASAN and/or KASAN_EXTRA, using a
+"noinline_if_stackbloat" annotation.
+
+That annotation now got replaced with a gcc-8 bugfix (see
+https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81715) and a workaround for
+older compilers, which means that KASAN_EXTRA is now just as bad as
+before and will lead to an instant stack overflow in a few extreme
+cases.
+
+This reverts parts of commit 3f181b4d8652 ("lib/Kconfig.debug: disable
+-Wframe-larger-than warnings with KASAN=y"). Two patches in linux-next
+should be merged first to avoid introducing warnings in an allmodconfig
+build:
+ 3cd890dbe2a4 ("media: dvb-frontends: fix i2c access helpers for KASAN")
+ 16c3ada89cff ("media: r820t: fix r820t_write_reg for KASAN")
+
+Do we really need to backport this?
+
+I think we do: without this patch, enabling KASAN will lead to
+unavoidable kernel stack overflow in certain device drivers when built
+with gcc-7 or higher on linux-4.10+ or any version that contains a
+backport of commit c5caf21ab0cf8. Most people are probably still on
+older compilers, but it will get worse over time as they upgrade their
+distros.
+
+The warnings we get on kernels older than this should all be for code
+that uses dangerously large stack frames, though most of them do not
+cause an actual stack overflow by themselves.The asan-stack option was
+added in linux-4.0, and commit 3f181b4d8652 ("lib/Kconfig.debug:
+disable -Wframe-larger-than warnings with KASAN=y") effectively turned
+off the warning for allmodconfig kernels, so I would like to see this
+fix backported to any kernels later than 4.0.
+
+I have done dozens of fixes for individual functions with stack frames
+larger than 2048 bytes with asan-stack, and I plan to make sure that
+all those fixes make it into the stable kernels as well (most are
+already there).
+
+Part of the complication here is that asan-stack (from 4.0) was
+originally assumed to always require much larger stacks, but that
+turned out to be a combination of multiple gcc bugs that we have now
+worked around and fixed, but sanitize-address-use-after-scope (from
+v4.10) has a much higher inherent stack usage and also suffers from at
+least three other problems that we have analyzed but not yet fixed
+upstream, each of them makes the stack usage more severe than it should
+be.
+
+Link: http://lkml.kernel.org/r/20171221134744.2295529-1-arnd@arndb.de
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Acked-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
+Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
+Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
+Cc: Alexander Potapenko <glider@google.com>
+Cc: Dmitry Vyukov <dvyukov@google.com>
+Cc: Andrey Konovalov <andreyknvl@google.com>
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+[arnd: rebase to v4.4; only re-enable warning]
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ lib/Kconfig.debug | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/lib/Kconfig.debug
++++ b/lib/Kconfig.debug
+@@ -197,7 +197,7 @@ config ENABLE_MUST_CHECK
+ config FRAME_WARN
+ int "Warn for stack frames larger than (needs gcc 4.4)"
+ range 0 8192
+- default 0 if KASAN
++ default 2048 if GCC_PLUGIN_LATENT_ENTROPY
+ default 1024 if !64BIT
+ default 2048 if 64BIT
+ help
--- /dev/null
+From e42eef4ba38806b18c4a74f0c276fb2e0b548173 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Wed, 4 Oct 2017 12:28:18 +0200
+Subject: KVM: add X86_LOCAL_APIC dependency
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit e42eef4ba38806b18c4a74f0c276fb2e0b548173 upstream.
+
+The rework of the posted interrupt handling broke building without
+support for the local APIC:
+
+ERROR: "boot_cpu_physical_apicid" [arch/x86/kvm/kvm-intel.ko] undefined!
+
+That configuration is probably not particularly useful anyway, so
+we can avoid the randconfig failures by adding a Kconfig dependency.
+
+Fixes: 8b306e2f3c41 ("KVM: VMX: avoid double list add with VT-d posted interrupts")
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/x86/kvm/Kconfig | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/arch/x86/kvm/Kconfig
++++ b/arch/x86/kvm/Kconfig
+@@ -23,6 +23,7 @@ config KVM
+ depends on HIGH_RES_TIMERS
+ # for TASKSTATS/TASK_DELAY_ACCT:
+ depends on NET && MULTIUSER
++ depends on X86_LOCAL_APIC
+ select PREEMPT_NOTIFIERS
+ select MMU_NOTIFIER
+ select ANON_INODES
--- /dev/null
+From 9a6e7c39810e4a8bc7fc95056cefb40583fe07ef Mon Sep 17 00:00:00 2001
+From: Wanpeng Li <wanpeng.li@hotmail.com>
+Date: Thu, 14 Sep 2017 03:54:16 -0700
+Subject: KVM: async_pf: Fix #DF due to inject "Page not Present" and "Page Ready" exceptions simultaneously
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Wanpeng Li <wanpeng.li@hotmail.com>
+
+commit 9a6e7c39810e4a8bc7fc95056cefb40583fe07ef upstream.
+
+qemu-system-x86-8600 [004] d..1 7205.687530: kvm_entry: vcpu 2
+qemu-system-x86-8600 [004] .... 7205.687532: kvm_exit: reason EXCEPTION_NMI rip 0xffffffffa921297d info ffffeb2c0e44e018 80000b0e
+qemu-system-x86-8600 [004] .... 7205.687532: kvm_page_fault: address ffffeb2c0e44e018 error_code 0
+qemu-system-x86-8600 [004] .... 7205.687620: kvm_try_async_get_page: gva = 0xffffeb2c0e44e018, gfn = 0x427e4e
+qemu-system-x86-8600 [004] .N.. 7205.687628: kvm_async_pf_not_present: token 0x8b002 gva 0xffffeb2c0e44e018
+ kworker/4:2-7814 [004] .... 7205.687655: kvm_async_pf_completed: gva 0xffffeb2c0e44e018 address 0x7fcc30c4e000
+qemu-system-x86-8600 [004] .... 7205.687703: kvm_async_pf_ready: token 0x8b002 gva 0xffffeb2c0e44e018
+qemu-system-x86-8600 [004] d..1 7205.687711: kvm_entry: vcpu 2
+
+After running some memory intensive workload in guest, I catch the kworker
+which completes the GUP too quickly, and queues an "Page Ready" #PF exception
+after the "Page not Present" exception before the next vmentry as the above
+trace which will result in #DF injected to guest.
+
+This patch fixes it by clearing the queue for "Page not Present" if "Page Ready"
+occurs before the next vmentry since the GUP has already got the required page
+and shadow page table has already been fixed by "Page Ready" handler.
+
+Cc: Paolo Bonzini <pbonzini@redhat.com>
+Cc: Radim Krčmář <rkrcmar@redhat.com>
+Signed-off-by: Wanpeng Li <wanpeng.li@hotmail.com>
+Fixes: 7c90705bf2a3 ("KVM: Inject asynchronous page fault into a PV guest if page is swapped out.")
+[Changed indentation and added clearing of injected. - Radim]
+Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
+[port from upstream v4.14-rc1, Don't assign to kvm_queued_exception::injected or
+ x86_exception::async_page_fault]
+Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/x86/kvm/x86.c | 34 ++++++++++++++++++++++++++--------
+ 1 file changed, 26 insertions(+), 8 deletions(-)
+
+--- a/arch/x86/kvm/x86.c
++++ b/arch/x86/kvm/x86.c
+@@ -8210,6 +8210,13 @@ static int apf_put_user(struct kvm_vcpu
+ sizeof(val));
+ }
+
++static int apf_get_user(struct kvm_vcpu *vcpu, u32 *val)
++{
++
++ return kvm_read_guest_cached(vcpu->kvm, &vcpu->arch.apf.data, val,
++ sizeof(u32));
++}
++
+ void kvm_arch_async_page_not_present(struct kvm_vcpu *vcpu,
+ struct kvm_async_pf *work)
+ {
+@@ -8236,6 +8243,7 @@ void kvm_arch_async_page_present(struct
+ struct kvm_async_pf *work)
+ {
+ struct x86_exception fault;
++ u32 val;
+
+ if (work->wakeup_all)
+ work->arch.token = ~0; /* broadcast wakeup */
+@@ -8243,14 +8251,24 @@ void kvm_arch_async_page_present(struct
+ kvm_del_async_pf_gfn(vcpu, work->arch.gfn);
+ trace_kvm_async_pf_ready(work->arch.token, work->gva);
+
+- if ((vcpu->arch.apf.msr_val & KVM_ASYNC_PF_ENABLED) &&
+- !apf_put_user(vcpu, KVM_PV_REASON_PAGE_READY)) {
+- fault.vector = PF_VECTOR;
+- fault.error_code_valid = true;
+- fault.error_code = 0;
+- fault.nested_page_fault = false;
+- fault.address = work->arch.token;
+- kvm_inject_page_fault(vcpu, &fault);
++ if (vcpu->arch.apf.msr_val & KVM_ASYNC_PF_ENABLED &&
++ !apf_get_user(vcpu, &val)) {
++ if (val == KVM_PV_REASON_PAGE_NOT_PRESENT &&
++ vcpu->arch.exception.pending &&
++ vcpu->arch.exception.nr == PF_VECTOR &&
++ !apf_put_user(vcpu, 0)) {
++ vcpu->arch.exception.pending = false;
++ vcpu->arch.exception.nr = 0;
++ vcpu->arch.exception.has_error_code = false;
++ vcpu->arch.exception.error_code = 0;
++ } else if (!apf_put_user(vcpu, KVM_PV_REASON_PAGE_READY)) {
++ fault.vector = PF_VECTOR;
++ fault.error_code_valid = true;
++ fault.error_code = 0;
++ fault.nested_page_fault = false;
++ fault.address = work->arch.token;
++ kvm_inject_page_fault(vcpu, &fault);
++ }
+ }
+ vcpu->arch.apf.halted = false;
+ vcpu->arch.mp_state = KVM_MP_STATE_RUNNABLE;
--- /dev/null
+From foo@baz Fri Feb 23 17:23:58 CET 2018
+From: Jack Wang <jinpu.wang@profitbricks.com>
+Date: Fri, 23 Feb 2018 11:42:16 +0100
+Subject: kvm: nVMX: Fix kernel panics induced by illegal INVEPT/INVVPID types
+To: gregkh@linuxfoundation.org, stable@vger.kernel.org
+Cc: Jim Mattson <jmattson@google.com>, Paolo Bonzini <pbonzini@redhat.com>, Jack Wang <jinpu.wang@profitbricks.com>
+Message-ID: <1519382538-15143-28-git-send-email-jinpu.wangl@profitbricks.com>
+
+From: Jim Mattson <jmattson@google.com>
+
+commit 85c856b39b479dde410ddd09df1da745343010c9 upstream
+
+Bitwise shifts by amounts greater than or equal to the width of the left
+operand are undefined. A malicious guest can exploit this to crash a
+32-bit host, due to the BUG_ON(1)'s in handle_{invept,invvpid}.
+
+Signed-off-by: Jim Mattson <jmattson@google.com>
+Message-Id: <1477496318-17681-1-git-send-email-jmattson@google.com>
+[Change 1UL to 1, to match the range check on the shift count. - Paolo]
+Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
+[jwang: port from linux-4.9 to 4.4 ]
+Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/x86/kvm/vmx.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/arch/x86/kvm/vmx.c
++++ b/arch/x86/kvm/vmx.c
+@@ -7361,7 +7361,7 @@ static int handle_invept(struct kvm_vcpu
+
+ types = (vmx->nested.nested_vmx_ept_caps >> VMX_EPT_EXTENT_SHIFT) & 6;
+
+- if (!(types & (1UL << type))) {
++ if (type >= 32 || !(types & (1 << type))) {
+ nested_vmx_failValid(vcpu,
+ VMXERR_INVALID_OPERAND_TO_INVEPT_INVVPID);
+ skip_emulated_instruction(vcpu);
+@@ -7420,7 +7420,7 @@ static int handle_invvpid(struct kvm_vcp
+
+ types = (vmx->nested.nested_vmx_vpid_caps >> 8) & 0x7;
+
+- if (!(types & (1UL << type))) {
++ if (type >= 32 || !(types & (1 << type))) {
+ nested_vmx_failValid(vcpu,
+ VMXERR_INVALID_OPERAND_TO_INVEPT_INVVPID);
+ skip_emulated_instruction(vcpu);
--- /dev/null
+From foo@baz Fri Feb 23 17:23:58 CET 2018
+From: Jack Wang <jinpu.wang@profitbricks.com>
+Date: Fri, 23 Feb 2018 11:42:18 +0100
+Subject: KVM: nVMX: invvpid handling improvements
+To: gregkh@linuxfoundation.org, stable@vger.kernel.org
+Cc: "Jan Dakinevich" <jan.dakinevich@gmail.com>, "Radim Krčmář" <rkrcmar@redhat.com>, "Jack Wang" <jinpu.wang@profitbricks.com>
+Message-ID: <1519382538-15143-30-git-send-email-jinpu.wangl@profitbricks.com>
+
+From: Jan Dakinevich <jan.dakinevich@gmail.com>
+
+commit bcdde302b8268ef7dbc4ddbdaffb5b44eafe9a1e upstream
+
+ - Expose all invalidation types to the L1
+
+ - Reject invvpid instruction, if L1 passed zero vpid value to single
+ context invalidations
+
+Signed-off-by: Jan Dakinevich <jan.dakinevich@gmail.com>
+Tested-by: Ladi Prosek <lprosek@redhat.com>
+Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
+[jwang: port to 4.4]
+Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/x86/kvm/vmx.c | 36 ++++++++++++++++++++++++------------
+ 1 file changed, 24 insertions(+), 12 deletions(-)
+
+--- a/arch/x86/kvm/vmx.c
++++ b/arch/x86/kvm/vmx.c
+@@ -126,6 +126,12 @@ module_param_named(pml, enable_pml, bool
+
+ #define VMX_MISC_EMULATED_PREEMPTION_TIMER_RATE 5
+
++#define VMX_VPID_EXTENT_SUPPORTED_MASK \
++ (VMX_VPID_EXTENT_INDIVIDUAL_ADDR_BIT | \
++ VMX_VPID_EXTENT_SINGLE_CONTEXT_BIT | \
++ VMX_VPID_EXTENT_GLOBAL_CONTEXT_BIT | \
++ VMX_VPID_EXTENT_SINGLE_NON_GLOBAL_BIT)
++
+ /*
+ * These 2 parameters are used to config the controls for Pause-Loop Exiting:
+ * ple_gap: upper bound on the amount of time between two successive
+@@ -2657,8 +2663,7 @@ static void nested_vmx_setup_ctls_msrs(s
+ */
+ if (enable_vpid)
+ vmx->nested.nested_vmx_vpid_caps = VMX_VPID_INVVPID_BIT |
+- VMX_VPID_EXTENT_SINGLE_CONTEXT_BIT |
+- VMX_VPID_EXTENT_GLOBAL_CONTEXT_BIT;
++ VMX_VPID_EXTENT_SUPPORTED_MASK;
+ else
+ vmx->nested.nested_vmx_vpid_caps = 0;
+
+@@ -7418,7 +7423,8 @@ static int handle_invvpid(struct kvm_vcp
+ vmx_instruction_info = vmcs_read32(VMX_INSTRUCTION_INFO);
+ type = kvm_register_readl(vcpu, (vmx_instruction_info >> 28) & 0xf);
+
+- types = (vmx->nested.nested_vmx_vpid_caps >> 8) & 0x7;
++ types = (vmx->nested.nested_vmx_vpid_caps &
++ VMX_VPID_EXTENT_SUPPORTED_MASK) >> 8;
+
+ if (type >= 32 || !(types & (1 << type))) {
+ nested_vmx_failValid(vcpu,
+@@ -7440,21 +7446,27 @@ static int handle_invvpid(struct kvm_vcp
+ }
+
+ switch (type) {
++ case VMX_VPID_EXTENT_INDIVIDUAL_ADDR:
+ case VMX_VPID_EXTENT_SINGLE_CONTEXT:
+- /*
+- * Old versions of KVM use the single-context version so we
+- * have to support it; just treat it the same as all-context.
+- */
++ case VMX_VPID_EXTENT_SINGLE_NON_GLOBAL:
++ if (!vpid) {
++ nested_vmx_failValid(vcpu,
++ VMXERR_INVALID_OPERAND_TO_INVEPT_INVVPID);
++ skip_emulated_instruction(vcpu);
++ return 1;
++ }
++ break;
+ case VMX_VPID_EXTENT_ALL_CONTEXT:
+- __vmx_flush_tlb(vcpu, to_vmx(vcpu)->nested.vpid02);
+- nested_vmx_succeed(vcpu);
+ break;
+ default:
+- /* Trap individual address invalidation invvpid calls */
+- BUG_ON(1);
+- break;
++ WARN_ON_ONCE(1);
++ skip_emulated_instruction(vcpu);
++ return 1;
+ }
+
++ __vmx_flush_tlb(vcpu, vmx->nested.vpid02);
++ nested_vmx_succeed(vcpu);
++
+ skip_emulated_instruction(vcpu);
+ return 1;
+ }
--- /dev/null
+From foo@baz Fri Feb 23 17:23:58 CET 2018
+From: Jack Wang <jinpu.wang@profitbricks.com>
+Date: Fri, 23 Feb 2018 11:42:14 +0100
+Subject: KVM: nVMX: kmap() can't fail
+To: gregkh@linuxfoundation.org, stable@vger.kernel.org
+Cc: David Hildenbrand <david@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, Jack Wang <jinpu.wang@profitbricks.com>
+Message-ID: <1519382538-15143-26-git-send-email-jinpu.wangl@profitbricks.com>
+
+From: David Hildenbrand <david@redhat.com>
+
+commit 42cf014d38d8822cce63703a467e00f65d000952 upstream.
+
+kmap() can't fail, therefore it will always return a valid pointer. Let's
+just get rid of the unnecessary checks.
+
+Signed-off-by: David Hildenbrand <david@redhat.com>
+Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
+[jwang: port to 4.4]
+Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/x86/kvm/vmx.c | 9 ---------
+ 1 file changed, 9 deletions(-)
+
+--- a/arch/x86/kvm/vmx.c
++++ b/arch/x86/kvm/vmx.c
+@@ -4532,10 +4532,6 @@ static int vmx_complete_nested_posted_in
+ return 0;
+
+ vapic_page = kmap(vmx->nested.virtual_apic_page);
+- if (!vapic_page) {
+- WARN_ON(1);
+- return -ENOMEM;
+- }
+ __kvm_apic_update_irr(vmx->nested.pi_desc->pir, vapic_page);
+ kunmap(vmx->nested.virtual_apic_page);
+
+@@ -9238,11 +9234,6 @@ static inline bool nested_vmx_merge_msr_
+ return false;
+ }
+ msr_bitmap = (unsigned long *)kmap(page);
+- if (!msr_bitmap) {
+- nested_release_page_clean(page);
+- WARN_ON(1);
+- return false;
+- }
+
+ if (nested_cpu_has_virt_x2apic_mode(vmcs12)) {
+ if (nested_cpu_has_apic_reg_virt(vmcs12))
--- /dev/null
+From foo@baz Fri Feb 23 17:23:58 CET 2018
+From: Jack Wang <jinpu.wang@profitbricks.com>
+Date: Fri, 23 Feb 2018 11:42:15 +0100
+Subject: KVM: nVMX: vmx_complete_nested_posted_interrupt() can't fail
+To: gregkh@linuxfoundation.org, stable@vger.kernel.org
+Cc: David Hildenbrand <david@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, David Woodhouse <dwmw@amazon.co.uk>, Jack Wang <jinpu.wang@profitbricks.com>
+Message-ID: <1519382538-15143-27-git-send-email-jinpu.wangl@profitbricks.com>
+
+From: David Hildenbrand <david@redhat.com>
+
+(cherry picked from commit 6342c50ad12e8ce0736e722184a7dbdea4a3477f)
+
+vmx_complete_nested_posted_interrupt() can't fail, let's turn it into
+a void function.
+
+Signed-off-by: David Hildenbrand <david@redhat.com>
+Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
+Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
+[jwang: port to 4.4]
+Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/x86/kvm/vmx.c | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+--- a/arch/x86/kvm/vmx.c
++++ b/arch/x86/kvm/vmx.c
+@@ -4512,7 +4512,7 @@ static int vmx_cpu_uses_apicv(struct kvm
+ return enable_apicv && lapic_in_kernel(vcpu);
+ }
+
+-static int vmx_complete_nested_posted_interrupt(struct kvm_vcpu *vcpu)
++static void vmx_complete_nested_posted_interrupt(struct kvm_vcpu *vcpu)
+ {
+ struct vcpu_vmx *vmx = to_vmx(vcpu);
+ int max_irr;
+@@ -4523,13 +4523,13 @@ static int vmx_complete_nested_posted_in
+ vmx->nested.pi_pending) {
+ vmx->nested.pi_pending = false;
+ if (!pi_test_and_clear_on(vmx->nested.pi_desc))
+- return 0;
++ return;
+
+ max_irr = find_last_bit(
+ (unsigned long *)vmx->nested.pi_desc->pir, 256);
+
+ if (max_irr == 256)
+- return 0;
++ return;
+
+ vapic_page = kmap(vmx->nested.virtual_apic_page);
+ __kvm_apic_update_irr(vmx->nested.pi_desc->pir, vapic_page);
+@@ -4542,7 +4542,6 @@ static int vmx_complete_nested_posted_in
+ vmcs_write16(GUEST_INTR_STATUS, status);
+ }
+ }
+- return 0;
+ }
+
+ static inline bool kvm_vcpu_trigger_posted_interrupt(struct kvm_vcpu *vcpu)
+@@ -10155,7 +10154,8 @@ static int vmx_check_nested_events(struc
+ return 0;
+ }
+
+- return vmx_complete_nested_posted_interrupt(vcpu);
++ vmx_complete_nested_posted_interrupt(vcpu);
++ return 0;
+ }
+
+ static u32 vmx_get_preemption_timer_value(struct kvm_vcpu *vcpu)
--- /dev/null
+From foo@baz Fri Feb 23 17:23:58 CET 2018
+From: Jack Wang <jinpu.wang@profitbricks.com>
+Date: Fri, 23 Feb 2018 11:42:17 +0100
+Subject: KVM: VMX: clean up declaration of VPID/EPT invalidation types
+To: gregkh@linuxfoundation.org, stable@vger.kernel.org
+Cc: "Jan Dakinevich" <jan.dakinevich@gmail.com>, "Radim Krčmář" <rkrcmar@redhat.com>, "Jack Wang" <jinpu.wang@profitbricks.com>
+Message-ID: <1519382538-15143-29-git-send-email-jinpu.wangl@profitbricks.com>
+
+From: Jan Dakinevich <jan.dakinevich@gmail.com>
+
+commit 63f3ac48133a19110c8a3666028dbd9b1bf3dcb3 upstream
+
+- Remove VMX_EPT_EXTENT_INDIVIDUAL_ADDR, since there is no such type of
+ EPT invalidation
+
+ - Add missing VPID types names
+
+Signed-off-by: Jan Dakinevich <jan.dakinevich@gmail.com>
+Tested-by: Ladi Prosek <lprosek@redhat.com>
+Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
+[jwang: port to 4.4]
+Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/x86/include/asm/vmx.h | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+--- a/arch/x86/include/asm/vmx.h
++++ b/arch/x86/include/asm/vmx.h
+@@ -400,10 +400,11 @@ enum vmcs_field {
+ #define IDENTITY_PAGETABLE_PRIVATE_MEMSLOT (KVM_USER_MEM_SLOTS + 2)
+
+ #define VMX_NR_VPIDS (1 << 16)
++#define VMX_VPID_EXTENT_INDIVIDUAL_ADDR 0
+ #define VMX_VPID_EXTENT_SINGLE_CONTEXT 1
+ #define VMX_VPID_EXTENT_ALL_CONTEXT 2
++#define VMX_VPID_EXTENT_SINGLE_NON_GLOBAL 3
+
+-#define VMX_EPT_EXTENT_INDIVIDUAL_ADDR 0
+ #define VMX_EPT_EXTENT_CONTEXT 1
+ #define VMX_EPT_EXTENT_GLOBAL 2
+ #define VMX_EPT_EXTENT_SHIFT 24
+@@ -420,8 +421,10 @@ enum vmcs_field {
+ #define VMX_EPT_EXTENT_GLOBAL_BIT (1ull << 26)
+
+ #define VMX_VPID_INVVPID_BIT (1ull << 0) /* (32 - 32) */
++#define VMX_VPID_EXTENT_INDIVIDUAL_ADDR_BIT (1ull << 8) /* (40 - 32) */
+ #define VMX_VPID_EXTENT_SINGLE_CONTEXT_BIT (1ull << 9) /* (41 - 32) */
+ #define VMX_VPID_EXTENT_GLOBAL_CONTEXT_BIT (1ull << 10) /* (42 - 32) */
++#define VMX_VPID_EXTENT_SINGLE_NON_GLOBAL_BIT (1ull << 11) /* (43 - 32) */
+
+ #define VMX_EPT_DEFAULT_GAW 3
+ #define VMX_EPT_MAX_GAW 0x4
--- /dev/null
+From foo@baz Fri Feb 23 17:23:58 CET 2018
+From: Jack Wang <jinpu.wang@profitbricks.com>
+Date: Fri, 23 Feb 2018 11:41:53 +0100
+Subject: KVM: VMX: Make indirect call speculation safe
+To: gregkh@linuxfoundation.org, stable@vger.kernel.org
+Cc: Peter Zijlstra <peterz@infradead.org>, Thomas Gleixner <tglx@linutronix.de>, Andrea Arcangeli <aarcange@redhat.com>, Andi Kleen <ak@linux.intel.com>, Ashok Raj <ashok.raj@intel.com>, Jun Nakajima <jun.nakajima@intel.com>, David Woodhouse <dwmw2@infradead.org>, Linus Torvalds <torvalds@linux-foundation.org>, rga@amazon.de, Dave Hansen <dave.hansen@intel.com>, Asit Mallick <asit.k.mallick@intel.com>, Andy Lutomirski <luto@kernel.org>, Josh Poimboeuf <jpoimboe@redhat.com>, Jason Baron <jbaron@akamai.com>, Paolo Bonzini <pbonzini@redhat.com>, Dan Williams <dan.j.williams@intel.com>, Arjan Van De Ven <arjan.van.de.ven@intel.com>, Tim Chen <tim.c.chen@linux.intel.com>, David Woodhouse <dwmw@amazon.co.uk>, Jack Wang <jinpu.wang@profitbricks.com>
+Message-ID: <1519382538-15143-5-git-send-email-jinpu.wangl@profitbricks.com>
+
+From: Peter Zijlstra <peterz@infradead.org>
+
+(cherry picked from commit c940a3fb1e2e9b7d03228ab28f375fb5a47ff699)
+
+Replace indirect call with CALL_NOSPEC.
+
+Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
+Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
+Reviewed-by: David Woodhouse <dwmw@amazon.co.uk>
+Cc: Andrea Arcangeli <aarcange@redhat.com>
+Cc: Andi Kleen <ak@linux.intel.com>
+Cc: Ashok Raj <ashok.raj@intel.com>
+Cc: Greg KH <gregkh@linuxfoundation.org>
+Cc: Jun Nakajima <jun.nakajima@intel.com>
+Cc: David Woodhouse <dwmw2@infradead.org>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: rga@amazon.de
+Cc: Dave Hansen <dave.hansen@intel.com>
+Cc: Asit Mallick <asit.k.mallick@intel.com>
+Cc: Andy Lutomirski <luto@kernel.org>
+Cc: Josh Poimboeuf <jpoimboe@redhat.com>
+Cc: Jason Baron <jbaron@akamai.com>
+Cc: Paolo Bonzini <pbonzini@redhat.com>
+Cc: Dan Williams <dan.j.williams@intel.com>
+Cc: Arjan Van De Ven <arjan.van.de.ven@intel.com>
+Cc: Tim Chen <tim.c.chen@linux.intel.com>
+Link: https://lkml.kernel.org/r/20180125095843.645776917@infradead.org
+Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
+[backport to 4.4]
+Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/x86/kvm/vmx.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/arch/x86/kvm/vmx.c
++++ b/arch/x86/kvm/vmx.c
+@@ -8377,13 +8377,13 @@ static void vmx_handle_external_intr(str
+ "pushf\n\t"
+ "orl $0x200, (%%" _ASM_SP ")\n\t"
+ __ASM_SIZE(push) " $%c[cs]\n\t"
+- "call *%[entry]\n\t"
++ CALL_NOSPEC
+ :
+ #ifdef CONFIG_X86_64
+ [sp]"=&r"(tmp)
+ #endif
+ :
+- [entry]"r"(entry),
++ THUNK_TARGET(entry),
+ [ss]"i"(__KERNEL_DS),
+ [cs]"i"(__KERNEL_CS)
+ );
--- /dev/null
+From foo@baz Fri Feb 23 17:23:58 CET 2018
+From: Jack Wang <jinpu.wang@profitbricks.com>
+Date: Fri, 23 Feb 2018 11:41:52 +0100
+Subject: KVM: x86: Make indirect calls in emulator speculation safe
+To: gregkh@linuxfoundation.org, stable@vger.kernel.org
+Cc: Peter Zijlstra <peterz@infradead.org>, Thomas Gleixner <tglx@linutronix.de>, Andrea Arcangeli <aarcange@redhat.com>, Andi Kleen <ak@linux.intel.com>, Ashok Raj <ashok.raj@intel.com>, Jun Nakajima <jun.nakajima@intel.com>, David Woodhouse <dwmw2@infradead.org>, Linus Torvalds <torvalds@linux-foundation.org>, rga@amazon.de, Dave Hansen <dave.hansen@intel.com>, Asit Mallick <asit.k.mallick@intel.com>, Andy Lutomirski <luto@kernel.org>, Josh Poimboeuf <jpoimboe@redhat.com>, Jason Baron <jbaron@akamai.com>, Paolo Bonzini <pbonzini@redhat.com>, Dan Williams <dan.j.williams@intel.com>, Arjan Van De Ven <arjan.van.de.ven@intel.com>, Tim Chen <tim.c.chen@linux.intel.com>, David Woodhouse <dwmw@amazon.co.uk>, Jack Wang <jinpu.wang@profitbricks.com>
+Message-ID: <1519382538-15143-4-git-send-email-jinpu.wangl@profitbricks.com>
+
+From: Peter Zijlstra <peterz@infradead.org>
+
+(cherry picked from commit 1a29b5b7f347a1a9230c1e0af5b37e3e571588ab)
+
+Replace the indirect calls with CALL_NOSPEC.
+
+Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
+Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
+Reviewed-by: David Woodhouse <dwmw@amazon.co.uk>
+Cc: Andrea Arcangeli <aarcange@redhat.com>
+Cc: Andi Kleen <ak@linux.intel.com>
+Cc: Ashok Raj <ashok.raj@intel.com>
+Cc: Greg KH <gregkh@linuxfoundation.org>
+Cc: Jun Nakajima <jun.nakajima@intel.com>
+Cc: David Woodhouse <dwmw2@infradead.org>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: rga@amazon.de
+Cc: Dave Hansen <dave.hansen@intel.com>
+Cc: Asit Mallick <asit.k.mallick@intel.com>
+Cc: Andy Lutomirski <luto@kernel.org>
+Cc: Josh Poimboeuf <jpoimboe@redhat.com>
+Cc: Jason Baron <jbaron@akamai.com>
+Cc: Paolo Bonzini <pbonzini@redhat.com>
+Cc: Dan Williams <dan.j.williams@intel.com>
+Cc: Arjan Van De Ven <arjan.van.de.ven@intel.com>
+Cc: Tim Chen <tim.c.chen@linux.intel.com>
+Link: https://lkml.kernel.org/r/20180125095843.595615683@infradead.org
+[dwmw2: Use ASM_CALL_CONSTRAINT like upstream, now we have it]
+Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
+[backport to 4.4]
+Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/x86/kvm/emulate.c | 9 +++++----
+ 1 file changed, 5 insertions(+), 4 deletions(-)
+
+--- a/arch/x86/kvm/emulate.c
++++ b/arch/x86/kvm/emulate.c
+@@ -26,6 +26,7 @@
+ #include <asm/kvm_emulate.h>
+ #include <linux/stringify.h>
+ #include <asm/debugreg.h>
++#include <asm/nospec-branch.h>
+
+ #include "x86.h"
+ #include "tss.h"
+@@ -1000,8 +1001,8 @@ static u8 test_cc(unsigned int condition
+ void (*fop)(void) = (void *)em_setcc + 4 * (condition & 0xf);
+
+ flags = (flags & EFLAGS_MASK) | X86_EFLAGS_IF;
+- asm("push %[flags]; popf; call *%[fastop]"
+- : "=a"(rc) : [fastop]"r"(fop), [flags]"r"(flags));
++ asm("push %[flags]; popf; " CALL_NOSPEC
++ : "=a"(rc) : [thunk_target]"r"(fop), [flags]"r"(flags));
+ return rc;
+ }
+
+@@ -5297,9 +5298,9 @@ static int fastop(struct x86_emulate_ctx
+ ulong flags = (ctxt->eflags & EFLAGS_MASK) | X86_EFLAGS_IF;
+ if (!(ctxt->d & ByteOp))
+ fop += __ffs(ctxt->dst.bytes) * FASTOP_SIZE;
+- asm("push %[flags]; popf; call *%[fastop]; pushf; pop %[flags]\n"
++ asm("push %[flags]; popf; " CALL_NOSPEC "; pushf; pop %[flags]\n"
+ : "+a"(ctxt->dst.val), "+d"(ctxt->src.val), [flags]"+D"(flags),
+- [fastop]"+S"(fop)
++ [thunk_target]"+S"(fop)
+ : "c"(ctxt->src2.val));
+ ctxt->eflags = (ctxt->eflags & ~EFLAGS_MASK) | (flags & EFLAGS_MASK);
+ if (!fop) /* exception is returned in fop variable */
--- /dev/null
+From 3312c951efaba55080958974047414576b9e5d63 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Mon, 21 Dec 2015 10:51:01 +1100
+Subject: md: avoid warning for 32-bit sector_t
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit 3312c951efaba55080958974047414576b9e5d63 upstream.
+
+When CONFIG_LBDAF is not set, sector_t is only 32-bits wide, which
+means we cannot have devices with more than 2TB, and the code that
+is trying to handle compatibility support for large devices in
+md version 0.90 is meaningless but also causes a compile-time warning:
+
+drivers/md/md.c: In function 'super_90_load':
+drivers/md/md.c:1029:19: warning: large integer implicitly truncated to unsigned type [-Woverflow]
+drivers/md/md.c: In function 'super_90_rdev_size_change':
+drivers/md/md.c:1323:17: warning: large integer implicitly truncated to unsigned type [-Woverflow]
+
+This adds a check for CONFIG_LBDAF to avoid even getting into this
+code path, and also adds an explicit cast to let the compiler know
+it doesn't have to warn about the truncation.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: NeilBrown <neilb@suse.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/md/md.c | 10 ++++++----
+ 1 file changed, 6 insertions(+), 4 deletions(-)
+
+--- a/drivers/md/md.c
++++ b/drivers/md/md.c
+@@ -1028,8 +1028,9 @@ static int super_90_load(struct md_rdev
+ * (not needed for Linear and RAID0 as metadata doesn't
+ * record this size)
+ */
+- if (rdev->sectors >= (2ULL << 32) && sb->level >= 1)
+- rdev->sectors = (2ULL << 32) - 2;
++ if (IS_ENABLED(CONFIG_LBDAF) && (u64)rdev->sectors >= (2ULL << 32) &&
++ sb->level >= 1)
++ rdev->sectors = (sector_t)(2ULL << 32) - 2;
+
+ if (rdev->sectors < ((sector_t)sb->size) * 2 && sb->level >= 1)
+ /* "this cannot possibly happen" ... */
+@@ -1322,8 +1323,9 @@ super_90_rdev_size_change(struct md_rdev
+ /* Limit to 4TB as metadata cannot record more than that.
+ * 4TB == 2^32 KB, or 2*2^32 sectors.
+ */
+- if (num_sectors >= (2ULL << 32) && rdev->mddev->level >= 1)
+- num_sectors = (2ULL << 32) - 2;
++ if (IS_ENABLED(CONFIG_LBDAF) && (u64)num_sectors >= (2ULL << 32) &&
++ rdev->mddev->level >= 1)
++ num_sectors = (sector_t)(2ULL << 32) - 2;
+ md_super_write(rdev->mddev, rdev, rdev->sb_start, rdev->sb_size,
+ rdev->sb_page);
+ md_super_wait(rdev->mddev);
--- /dev/null
+From 5d06ee20b662a78417245714fc576cba90e6374f Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Thu, 25 Feb 2016 17:31:32 +0100
+Subject: modsign: hide openssl output in silent builds
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit 5d06ee20b662a78417245714fc576cba90e6374f upstream.
+
+When a user calls 'make -s', we can assume they don't want to
+see any output except for warnings and errors, but instead
+they see this for a warning free build:
+
+ ###
+ ### Now generating an X.509 key pair to be used for signing modules.
+ ###
+ ### If this takes a long time, you might wish to run rngd in the
+ ### background to keep the supply of entropy topped up. It
+ ### needs to be run as root, and uses a hardware random
+ ### number generator if one is available.
+ ###
+ Generating a 4096 bit RSA private key
+ .................................................................................................................................................................................................................................++
+ ..............................................................................................................................++
+ writing new private key to 'certs/signing_key.pem'
+ -----
+ ###
+ ### Key pair generated.
+ ###
+
+The output can confuse simple build testing scripts that just check
+for an empty build log.
+
+This patch silences all the output:
+ - "echo" is changed to "@$(kecho)", which is dropped when "-s" gets
+ passed
+ - the openssl command itself is only printed with V=1, using the
+ $(Q) macro
+ - The output of openssl gets redirected to /dev/null on "-s" builds.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: David Howells <dhowells@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ certs/Makefile | 33 +++++++++++++++++++--------------
+ 1 file changed, 19 insertions(+), 14 deletions(-)
+
+--- a/certs/Makefile
++++ b/certs/Makefile
+@@ -36,29 +36,34 @@ ifndef CONFIG_MODULE_SIG_HASH
+ $(error Could not determine digest type to use from kernel config)
+ endif
+
++redirect_openssl = 2>&1
++quiet_redirect_openssl = 2>&1
++silent_redirect_openssl = 2>/dev/null
++
+ # We do it this way rather than having a boolean option for enabling an
+ # external private key, because 'make randconfig' might enable such a
+ # boolean option and we unfortunately can't make it depend on !RANDCONFIG.
+ ifeq ($(CONFIG_MODULE_SIG_KEY),"certs/signing_key.pem")
+ $(obj)/signing_key.pem: $(obj)/x509.genkey
+- @echo "###"
+- @echo "### Now generating an X.509 key pair to be used for signing modules."
+- @echo "###"
+- @echo "### If this takes a long time, you might wish to run rngd in the"
+- @echo "### background to keep the supply of entropy topped up. It"
+- @echo "### needs to be run as root, and uses a hardware random"
+- @echo "### number generator if one is available."
+- @echo "###"
+- openssl req -new -nodes -utf8 -$(CONFIG_MODULE_SIG_HASH) -days 36500 \
++ @$(kecho) "###"
++ @$(kecho) "### Now generating an X.509 key pair to be used for signing modules."
++ @$(kecho) "###"
++ @$(kecho) "### If this takes a long time, you might wish to run rngd in the"
++ @$(kecho) "### background to keep the supply of entropy topped up. It"
++ @$(kecho) "### needs to be run as root, and uses a hardware random"
++ @$(kecho) "### number generator if one is available."
++ @$(kecho) "###"
++ $(Q)openssl req -new -nodes -utf8 -$(CONFIG_MODULE_SIG_HASH) -days 36500 \
+ -batch -x509 -config $(obj)/x509.genkey \
+ -outform PEM -out $(obj)/signing_key.pem \
+- -keyout $(obj)/signing_key.pem 2>&1
+- @echo "###"
+- @echo "### Key pair generated."
+- @echo "###"
++ -keyout $(obj)/signing_key.pem \
++ $($(quiet)redirect_openssl)
++ @$(kecho) "###"
++ @$(kecho) "### Key pair generated."
++ @$(kecho) "###"
+
+ $(obj)/x509.genkey:
+- @echo Generating X.509 key generation config
++ @$(kecho) Generating X.509 key generation config
+ @echo >$@ "[ req ]"
+ @echo >>$@ "default_bits = 4096"
+ @echo >>$@ "distinguished_name = req_distinguished_name"
--- /dev/null
+From foo@baz Fri Feb 23 17:23:58 CET 2018
+From: Jack Wang <jinpu.wang@profitbricks.com>
+Date: Fri, 23 Feb 2018 11:41:54 +0100
+Subject: module/retpoline: Warn about missing retpoline in module
+To: gregkh@linuxfoundation.org, stable@vger.kernel.org
+Cc: Andi Kleen <ak@linux.intel.com>, Thomas Gleixner <tglx@linutronix.de>, David Woodhouse <dwmw2@infradead.org>, torvalds@linux-foundation.org, jeyu@kernel.org, arjan@linux.intel.com, David Woodhouse <dwmw@amazon.co.uk>, Jack Wang <jinpu.wang@profitbricks.com>
+Message-ID: <1519382538-15143-6-git-send-email-jinpu.wangl@profitbricks.com>
+
+From: Andi Kleen <ak@linux.intel.com>
+
+(cherry picked from commit caf7501a1b4ec964190f31f9c3f163de252273b8)
+
+There's a risk that a kernel which has full retpoline mitigations becomes
+vulnerable when a module gets loaded that hasn't been compiled with the
+right compiler or the right option.
+
+To enable detection of that mismatch at module load time, add a module info
+string "retpoline" at build time when the module was compiled with
+retpoline support. This only covers compiled C source, but assembler source
+or prebuilt object files are not checked.
+
+If a retpoline enabled kernel detects a non retpoline protected module at
+load time, print a warning and report it in the sysfs vulnerability file.
+
+[ tglx: Massaged changelog ]
+
+Signed-off-by: Andi Kleen <ak@linux.intel.com>
+Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
+Cc: David Woodhouse <dwmw2@infradead.org>
+Cc: gregkh@linuxfoundation.org
+Cc: torvalds@linux-foundation.org
+Cc: jeyu@kernel.org
+Cc: arjan@linux.intel.com
+Link: https://lkml.kernel.org/r/20180125235028.31211-1-andi@firstfloor.org
+Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
+[jwang: port to 4.4]
+Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/x86/kernel/cpu/bugs.c | 18 +++++++++++++++++-
+ include/linux/module.h | 9 +++++++++
+ kernel/module.c | 11 +++++++++++
+ scripts/mod/modpost.c | 9 +++++++++
+ 4 files changed, 46 insertions(+), 1 deletion(-)
+
+--- a/arch/x86/kernel/cpu/bugs.c
++++ b/arch/x86/kernel/cpu/bugs.c
+@@ -10,6 +10,7 @@
+ #include <linux/init.h>
+ #include <linux/utsname.h>
+ #include <linux/cpu.h>
++#include <linux/module.h>
+
+ #include <asm/nospec-branch.h>
+ #include <asm/cmdline.h>
+@@ -93,6 +94,20 @@ static const char *spectre_v2_strings[]
+
+ static enum spectre_v2_mitigation spectre_v2_enabled = SPECTRE_V2_NONE;
+
++static bool spectre_v2_bad_module;
++
++#ifdef RETPOLINE
++bool retpoline_module_ok(bool has_retpoline)
++{
++ if (spectre_v2_enabled == SPECTRE_V2_NONE || has_retpoline)
++ return true;
++
++ pr_err("System may be vunerable to spectre v2\n");
++ spectre_v2_bad_module = true;
++ return false;
++}
++#endif
++
+ static void __init spec2_print_if_insecure(const char *reason)
+ {
+ if (boot_cpu_has_bug(X86_BUG_SPECTRE_V2))
+@@ -277,6 +292,7 @@ ssize_t cpu_show_spectre_v2(struct devic
+ if (!boot_cpu_has_bug(X86_BUG_SPECTRE_V2))
+ return sprintf(buf, "Not affected\n");
+
+- return sprintf(buf, "%s\n", spectre_v2_strings[spectre_v2_enabled]);
++ return sprintf(buf, "%s%s\n", spectre_v2_strings[spectre_v2_enabled],
++ spectre_v2_bad_module ? " - vulnerable module loaded" : "");
+ }
+ #endif
+--- a/include/linux/module.h
++++ b/include/linux/module.h
+@@ -789,6 +789,15 @@ static inline void module_bug_finalize(c
+ static inline void module_bug_cleanup(struct module *mod) {}
+ #endif /* CONFIG_GENERIC_BUG */
+
++#ifdef RETPOLINE
++extern bool retpoline_module_ok(bool has_retpoline);
++#else
++static inline bool retpoline_module_ok(bool has_retpoline)
++{
++ return true;
++}
++#endif
++
+ #ifdef CONFIG_MODULE_SIG
+ static inline bool module_sig_ok(struct module *module)
+ {
+--- a/kernel/module.c
++++ b/kernel/module.c
+@@ -2869,6 +2869,15 @@ static struct module *setup_load_info(st
+ return mod;
+ }
+
++static void check_modinfo_retpoline(struct module *mod, struct load_info *info)
++{
++ if (retpoline_module_ok(get_modinfo(info, "retpoline")))
++ return;
++
++ pr_warn("%s: loading module not compiled with retpoline compiler.\n",
++ mod->name);
++}
++
+ static int check_modinfo(struct module *mod, struct load_info *info, int flags)
+ {
+ const char *modmagic = get_modinfo(info, "vermagic");
+@@ -2895,6 +2904,8 @@ static int check_modinfo(struct module *
+ add_taint_module(mod, TAINT_OOT_MODULE, LOCKDEP_STILL_OK);
+ }
+
++ check_modinfo_retpoline(mod, info);
++
+ if (get_modinfo(info, "staging")) {
+ add_taint_module(mod, TAINT_CRAP, LOCKDEP_STILL_OK);
+ pr_warn("%s: module is from the staging directory, the quality "
+--- a/scripts/mod/modpost.c
++++ b/scripts/mod/modpost.c
+@@ -2129,6 +2129,14 @@ static void add_intree_flag(struct buffe
+ buf_printf(b, "\nMODULE_INFO(intree, \"Y\");\n");
+ }
+
++/* Cannot check for assembler */
++static void add_retpoline(struct buffer *b)
++{
++ buf_printf(b, "\n#ifdef RETPOLINE\n");
++ buf_printf(b, "MODULE_INFO(retpoline, \"Y\");\n");
++ buf_printf(b, "#endif\n");
++}
++
+ static void add_staging_flag(struct buffer *b, const char *name)
+ {
+ static const char *staging_dir = "drivers/staging";
+@@ -2473,6 +2481,7 @@ int main(int argc, char **argv)
+
+ add_header(&buf, mod);
+ add_intree_flag(&buf, !external_module);
++ add_retpoline(&buf);
+ add_staging_flag(&buf, mod->name);
+ err |= add_versions(&buf, mod);
+ add_depends(&buf, mod, modules);
--- /dev/null
+From 28558f5af50d8335cbbc8bc2726e0747553e29f5 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Wed, 27 Jan 2016 16:57:18 +0100
+Subject: mptfusion: hide unused seq_mpt_print_ioc_summary function
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit 28558f5af50d8335cbbc8bc2726e0747553e29f5 upstream.
+
+The seq_mpt_print_ioc_summary function is used for the
+/proc/mpt/iocN/summary implementation and never gets called when
+CONFIG_PROC_FS is disabled:
+
+drivers/message/fusion/mptbase.c:6851:13: warning: 'seq_mpt_print_ioc_summary' defined but not used [-Wunused-function]
+ static void seq_mpt_print_ioc_summary(MPT_ADAPTER *ioc, struct seq_file *m, int showlan)
+
+This adds an #ifdef to hide the function definition in that case and
+avoid the warning.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/message/fusion/mptbase.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/drivers/message/fusion/mptbase.c
++++ b/drivers/message/fusion/mptbase.c
+@@ -6848,6 +6848,7 @@ mpt_print_ioc_summary(MPT_ADAPTER *ioc,
+ *size = y;
+ }
+
++#ifdef CONFIG_PROC_FS
+ static void seq_mpt_print_ioc_summary(MPT_ADAPTER *ioc, struct seq_file *m, int showlan)
+ {
+ char expVer[32];
+@@ -6879,6 +6880,7 @@ static void seq_mpt_print_ioc_summary(MP
+
+ seq_putc(m, '\n');
+ }
++#endif
+
+ /**
+ * mpt_set_taskmgmt_in_progress_flag - set flags associated with task management
--- /dev/null
+From f5f92b36fbbb8ac7d70ff5fa39ec2637cce3094c Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Mon, 23 Nov 2015 14:39:33 +0100
+Subject: mtd: cfi: enforce valid geometry configuration
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit f5f92b36fbbb8ac7d70ff5fa39ec2637cce3094c upstream.
+
+MTD allows compile-time configuration of the possible CFI geometry
+settings that are allowed by the kernel, but that includes a couple of
+invalid configurations, where no bank width or no interleave setting
+is allowed. These are then caught with a compile-time warning:
+
+include/linux/mtd/cfi.h:76:2: warning: #warning No CONFIG_MTD_CFI_Ix selected. No NOR chip support can work.
+include/linux/mtd/map.h:145:2: warning: #warning "No CONFIG_MTD_MAP_BANK_WIDTH_xx selected. No NOR chip support can work"
+
+This is a bit annoying for randconfig tests, and can be avoided if
+we change the Kconfig logic to always select the simplest configuration
+when no other one is enabled.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Brian Norris <computersforpeace@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/mtd/chips/Kconfig | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+--- a/drivers/mtd/chips/Kconfig
++++ b/drivers/mtd/chips/Kconfig
+@@ -67,6 +67,10 @@ endchoice
+ config MTD_CFI_GEOMETRY
+ bool "Specific CFI Flash geometry selection"
+ depends on MTD_CFI_ADV_OPTIONS
++ select MTD_MAP_BANK_WIDTH_1 if !(MTD_MAP_BANK_WIDTH_2 || \
++ MTD_MAP_BANK_WIDTH_4 || MTD_MAP_BANK_WIDTH_8 || \
++ MTD_MAP_BANK_WIDTH_16 || MTD_MAP_BANK_WIDTH_32)
++ select MTD_CFI_I1 if !(MTD_CFI_I2 || MTD_CFI_I4 || MTD_CFI_I8)
+ help
+ This option does not affect the code directly, but will enable
+ some other configuration options which would allow you to reduce
--- /dev/null
+From e70dda0868fad0f74c46df21f7f45fec24f29879 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Mon, 24 Oct 2016 17:28:35 +0200
+Subject: mtd: ichxrom: maybe-uninitialized with gcc-4.9
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit e70dda0868fad0f74c46df21f7f45fec24f29879 upstream.
+
+pci_read_config_word() might fail and not initialize its output,
+as pointed out by older versions of gcc when using the -Wmaybe-unintialized
+flag:
+
+drivers/mtd/maps/ichxrom.c: In function ‘ichxrom_cleanup’:
+drivers/mtd/maps/ichxrom.c:63:2: error: ‘word’ is used uninitialized in this function [-Werror=uninitialized]
+
+This is apparently a correct warning, though it does not show up
+with newer compilers. Changing the code to not attempt to write
+back uninitialized data into PCI config space is a correct
+fix for the problem and avoids the warning.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Reviewed-by: Marek Vasut <marex@denx.de>
+Signed-off-by: Brian Norris <computersforpeace@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/mtd/maps/ichxrom.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+--- a/drivers/mtd/maps/ichxrom.c
++++ b/drivers/mtd/maps/ichxrom.c
+@@ -57,10 +57,12 @@ static void ichxrom_cleanup(struct ichxr
+ {
+ struct ichxrom_map_info *map, *scratch;
+ u16 word;
++ int ret;
+
+ /* Disable writes through the rom window */
+- pci_read_config_word(window->pdev, BIOS_CNTL, &word);
+- pci_write_config_word(window->pdev, BIOS_CNTL, word & ~1);
++ ret = pci_read_config_word(window->pdev, BIOS_CNTL, &word);
++ if (!ret)
++ pci_write_config_word(window->pdev, BIOS_CNTL, word & ~1);
+ pci_dev_put(window->pdev);
+
+ /* Free all of the mtd devices */
--- /dev/null
+From e4106a7c8236eb7b91686d36f3bf33ee43db94b4 Mon Sep 17 00:00:00 2001
+From: Julia Lawall <julia.lawall@lip6.fr>
+Date: Tue, 19 Apr 2016 14:33:33 +0200
+Subject: mtd: maps: add __init attribute
+
+From: Julia Lawall <julia.lawall@lip6.fr>
+
+commit e4106a7c8236eb7b91686d36f3bf33ee43db94b4 upstream.
+
+Add __init attribute on functions that are only called from other __init
+functions and that are not inlined, at least with gcc version 4.8.4 on an
+x86 machine with allyesconfig. Currently, the functions are put in the
+.text.unlikely segment. Declaring them as __init will cause them to be
+put in the .init.text and to disappear after initialization.
+
+The result of objdump -x on the functions before the change is as follows:
+
+00000000000001bc l F .text.unlikely 00000000000006a2 ck804xrom_init_one.isra.1
+00000000000001aa l F .text.unlikely 0000000000000764 esb2rom_init_one.isra.1
+00000000000001db l F .text.unlikely 0000000000000716 ichxrom_init_one.isra.1
+
+And after the change it is as follows:
+
+0000000000000000 l F .init.text 000000000000069d ck804xrom_init_one.isra.1
+0000000000000000 l F .init.text 000000000000075f esb2rom_init_one.isra.1
+0000000000000000 l F .init.text 0000000000000711 ichxrom_init_one.isra.1
+
+Done with the help of Coccinelle. The semantic patch checks for local
+static non-init functions that are called from an __init function and are
+not called from any other function.
+
+Note that in each case, the function is stored in the probe field of a
+pci_driver structure, but this code is under an #if 0. The #if 0s have
+been unchanged since 2009 at the latest.
+
+Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
+Signed-off-by: Brian Norris <computersforpeace@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/mtd/maps/ck804xrom.c | 4 ++--
+ drivers/mtd/maps/esb2rom.c | 4 ++--
+ drivers/mtd/maps/ichxrom.c | 4 ++--
+ 3 files changed, 6 insertions(+), 6 deletions(-)
+
+--- a/drivers/mtd/maps/ck804xrom.c
++++ b/drivers/mtd/maps/ck804xrom.c
+@@ -112,8 +112,8 @@ static void ck804xrom_cleanup(struct ck8
+ }
+
+
+-static int ck804xrom_init_one(struct pci_dev *pdev,
+- const struct pci_device_id *ent)
++static int __init ck804xrom_init_one(struct pci_dev *pdev,
++ const struct pci_device_id *ent)
+ {
+ static char *rom_probe_types[] = { "cfi_probe", "jedec_probe", NULL };
+ u8 byte;
+--- a/drivers/mtd/maps/esb2rom.c
++++ b/drivers/mtd/maps/esb2rom.c
+@@ -144,8 +144,8 @@ static void esb2rom_cleanup(struct esb2r
+ pci_dev_put(window->pdev);
+ }
+
+-static int esb2rom_init_one(struct pci_dev *pdev,
+- const struct pci_device_id *ent)
++static int __init esb2rom_init_one(struct pci_dev *pdev,
++ const struct pci_device_id *ent)
+ {
+ static char *rom_probe_types[] = { "cfi_probe", "jedec_probe", NULL };
+ struct esb2rom_window *window = &esb2rom_window;
+--- a/drivers/mtd/maps/ichxrom.c
++++ b/drivers/mtd/maps/ichxrom.c
+@@ -86,8 +86,8 @@ static void ichxrom_cleanup(struct ichxr
+ }
+
+
+-static int ichxrom_init_one(struct pci_dev *pdev,
+- const struct pci_device_id *ent)
++static int __init ichxrom_init_one(struct pci_dev *pdev,
++ const struct pci_device_id *ent)
+ {
+ static char *rom_probe_types[] = { "cfi_probe", "jedec_probe", NULL };
+ struct ichxrom_window *window = &ichxrom_window;
--- /dev/null
+From 1873315fb156cbc8e46f28e8b128f17ff6c31728 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Tue, 8 Dec 2015 16:38:12 +0100
+Subject: mtd: sh_flctl: pass FIFO as physical address
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit 1873315fb156cbc8e46f28e8b128f17ff6c31728 upstream.
+
+By convention, the FIFO address we pass using dmaengine_slave_config
+is a physical address in the form that is understood by the DMA
+engine, as a dma_addr_t, phys_addr_t or resource_size_t.
+
+The sh_flctl driver however passes a virtual __iomem address that
+gets cast to dma_addr_t in the slave driver. This happens to work
+on shmobile because that platform sets up an identity mapping for
+its MMIO regions, but such code is not portable to other platforms,
+and prevents us from ever changing the platform mapping or reusing
+the driver on other architectures like ARM64 that might not have the
+mapping.
+
+We also get a warning about a type mismatch for the case that
+dma_addr_t is wider than a pointer, i.e. when CONFIG_LPAE is set:
+
+drivers/mtd/nand/sh_flctl.c: In function 'flctl_setup_dma':
+drivers/mtd/nand/sh_flctl.c:163:17: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
+ cfg.dst_addr = (dma_addr_t)FLDTFIFO(flctl);
+
+This changes the driver to instead pass the physical address of
+the FIFO that is extracted from the MMIO resource, making the
+code more portable and avoiding the warning.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Brian Norris <computersforpeace@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/mtd/nand/sh_flctl.c | 5 +++--
+ include/linux/mtd/sh_flctl.h | 1 +
+ 2 files changed, 4 insertions(+), 2 deletions(-)
+
+--- a/drivers/mtd/nand/sh_flctl.c
++++ b/drivers/mtd/nand/sh_flctl.c
+@@ -160,7 +160,7 @@ static void flctl_setup_dma(struct sh_fl
+
+ memset(&cfg, 0, sizeof(cfg));
+ cfg.direction = DMA_MEM_TO_DEV;
+- cfg.dst_addr = (dma_addr_t)FLDTFIFO(flctl);
++ cfg.dst_addr = flctl->fifo;
+ cfg.src_addr = 0;
+ ret = dmaengine_slave_config(flctl->chan_fifo0_tx, &cfg);
+ if (ret < 0)
+@@ -176,7 +176,7 @@ static void flctl_setup_dma(struct sh_fl
+
+ cfg.direction = DMA_DEV_TO_MEM;
+ cfg.dst_addr = 0;
+- cfg.src_addr = (dma_addr_t)FLDTFIFO(flctl);
++ cfg.src_addr = flctl->fifo;
+ ret = dmaengine_slave_config(flctl->chan_fifo0_rx, &cfg);
+ if (ret < 0)
+ goto err;
+@@ -1096,6 +1096,7 @@ static int flctl_probe(struct platform_d
+ flctl->reg = devm_ioremap_resource(&pdev->dev, res);
+ if (IS_ERR(flctl->reg))
+ return PTR_ERR(flctl->reg);
++ flctl->fifo = res->start + 0x24; /* FLDTFIFO */
+
+ irq = platform_get_irq(pdev, 0);
+ if (irq < 0) {
+--- a/include/linux/mtd/sh_flctl.h
++++ b/include/linux/mtd/sh_flctl.h
+@@ -148,6 +148,7 @@ struct sh_flctl {
+ struct platform_device *pdev;
+ struct dev_pm_qos_request pm_qos;
+ void __iomem *reg;
++ resource_size_t fifo;
+
+ uint8_t done_buff[2048 + 64]; /* max size 2048 + 64 */
+ int read_bytes;
--- /dev/null
+From 9a232de4999666b2e8ea6775b2b0e3e4feb09b7a Mon Sep 17 00:00:00 2001
+From: Miklos Szeredi <mszeredi@redhat.com>
+Date: Tue, 27 Sep 2016 11:03:57 +0200
+Subject: ncpfs: fix unused variable warning
+
+From: Miklos Szeredi <mszeredi@redhat.com>
+
+commit 9a232de4999666b2e8ea6775b2b0e3e4feb09b7a upstream.
+
+Without CONFIG_NCPFS_NLS the following warning is seen:
+
+fs/ncpfs/dir.c: In function 'ncp_hash_dentry':
+fs/ncpfs/dir.c:136:23: warning: unused variable 'sb' [-Wunused-variable]
+ struct super_block *sb = dentry->d_sb;
+
+Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/ncpfs/dir.c | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+--- a/fs/ncpfs/dir.c
++++ b/fs/ncpfs/dir.c
+@@ -133,12 +133,11 @@ ncp_hash_dentry(const struct dentry *den
+ return 0;
+
+ if (!ncp_case_sensitive(inode)) {
+- struct super_block *sb = dentry->d_sb;
+ struct nls_table *t;
+ unsigned long hash;
+ int i;
+
+- t = NCP_IO_TABLE(sb);
++ t = NCP_IO_TABLE(dentry->d_sb);
+ hash = init_name_hash();
+ for (i=0; i<this->len ; i++)
+ hash = partial_name_hash(ncp_tolower(t, this->name[i]),
--- /dev/null
+From foo@baz Fri Feb 23 17:12:49 CET 2018
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Tue, 20 Feb 2018 12:54:55 +0100
+Subject: ncr5380: shut up gcc indentation warning
+To: stable@vger.kernel.org
+Cc: Greg KH <gregkh@linuxfoundation.org>, linux-kernel@vger.kernel.org, Arnd Bergmann <arnd@arndb.de>, Finn Thain <fthain@telegraphics.com.au>, Michael Schmitz <schmitzmic@gmail.com>, "James E.J. Bottomley" <JBottomley@odin.com>, "Martin K. Petersen" <martin.petersen@oracle.com>, linux-scsi@vger.kernel.org
+Message-ID: <20180220115527.1806578-9-arnd@arndb.de>
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+gcc-6 and higher warn about the way some loops are written in
+the ncr5380 driver:
+
+drivers/scsi/g_NCR5380.c: In function 'generic_NCR5380_pread':
+drivers/scsi/g_NCR5380.c:541:3: error: this 'while' clause does not guard... [-Werror=misleading-indentation]
+ while (NCR5380_read(C400_CONTROL_STATUS_REG) & CSR_HOST_BUF_NOT_RDY);
+ ^~~~~
+drivers/scsi/g_NCR5380.c:544:3: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'while'
+
+This was addressed in mainline kernels as part of a rework on commit
+12150797d064 ("ncr5380: Use runtime register mapping"). We don't
+want the entire patch backported to stable kernels, but we can
+backport one hunk to get rid of the warning.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Acked-by: Finn Thain <fthain@telegraphics.com.au>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/scsi/g_NCR5380.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+--- a/drivers/scsi/g_NCR5380.c
++++ b/drivers/scsi/g_NCR5380.c
+@@ -538,7 +538,10 @@ static inline int NCR5380_pread(struct S
+ printk(KERN_ERR "53C400r: Got 53C80_IRQ start=%d, blocks=%d\n", start, blocks);
+ return -1;
+ }
+- while (NCR5380_read(C400_CONTROL_STATUS_REG) & CSR_HOST_BUF_NOT_RDY);
++ while (NCR5380_read(C400_CONTROL_STATUS_REG) & CSR_HOST_BUF_NOT_RDY)
++ {
++ // FIXME - no timeout
++ }
+
+ #ifndef SCSI_G_NCR5380_MEM
+ {
--- /dev/null
+From 747a11279a442b913a57bf38934879babab3b58b Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Fri, 29 Jan 2016 12:39:11 +0100
+Subject: net: hp100: remove unnecessary #ifdefs
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit 747a11279a442b913a57bf38934879babab3b58b upstream.
+
+Building the hp100 ethernet driver causes warnings when both the PCI
+and EISA drivers are disabled:
+
+ethernet/hp/hp100.c: In function 'hp100_module_init':
+ethernet/hp/hp100.c:3047:2: warning: label 'out3' defined but not used [-Wunused-label]
+ethernet/hp/hp100.c: At top level:
+ethernet/hp/hp100.c:2828:13: warning: 'cleanup_dev' defined but not used [-Wunused-function]
+
+We can easily avoid the warnings and make the driver look slightly
+nicer by removing the #ifdefs that check for the CONFIG_PCI and
+CONFIG_EISA, as all the registration functions are designed to
+have no effect when the buses are disabled.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/net/ethernet/hp/hp100.c | 18 ------------------
+ 1 file changed, 18 deletions(-)
+
+--- a/drivers/net/ethernet/hp/hp100.c
++++ b/drivers/net/ethernet/hp/hp100.c
+@@ -194,7 +194,6 @@ static const char *hp100_isa_tbl[] = {
+ };
+ #endif
+
+-#ifdef CONFIG_EISA
+ static struct eisa_device_id hp100_eisa_tbl[] = {
+ { "HWPF180" }, /* HP J2577 rev A */
+ { "HWP1920" }, /* HP 27248B */
+@@ -205,9 +204,7 @@ static struct eisa_device_id hp100_eisa_
+ { "" } /* Mandatory final entry ! */
+ };
+ MODULE_DEVICE_TABLE(eisa, hp100_eisa_tbl);
+-#endif
+
+-#ifdef CONFIG_PCI
+ static const struct pci_device_id hp100_pci_tbl[] = {
+ {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_J2585A, PCI_ANY_ID, PCI_ANY_ID,},
+ {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_J2585B, PCI_ANY_ID, PCI_ANY_ID,},
+@@ -219,7 +216,6 @@ static const struct pci_device_id hp100_
+ {} /* Terminating entry */
+ };
+ MODULE_DEVICE_TABLE(pci, hp100_pci_tbl);
+-#endif
+
+ static int hp100_rx_ratio = HP100_DEFAULT_RX_RATIO;
+ static int hp100_priority_tx = HP100_DEFAULT_PRIORITY_TX;
+@@ -2842,7 +2838,6 @@ static void cleanup_dev(struct net_devic
+ free_netdev(d);
+ }
+
+-#ifdef CONFIG_EISA
+ static int hp100_eisa_probe(struct device *gendev)
+ {
+ struct net_device *dev = alloc_etherdev(sizeof(struct hp100_private));
+@@ -2884,9 +2879,7 @@ static struct eisa_driver hp100_eisa_dri
+ .remove = hp100_eisa_remove,
+ }
+ };
+-#endif
+
+-#ifdef CONFIG_PCI
+ static int hp100_pci_probe(struct pci_dev *pdev,
+ const struct pci_device_id *ent)
+ {
+@@ -2955,7 +2948,6 @@ static struct pci_driver hp100_pci_drive
+ .probe = hp100_pci_probe,
+ .remove = hp100_pci_remove,
+ };
+-#endif
+
+ /*
+ * module section
+@@ -3032,23 +3024,17 @@ static int __init hp100_module_init(void
+ err = hp100_isa_init();
+ if (err && err != -ENODEV)
+ goto out;
+-#ifdef CONFIG_EISA
+ err = eisa_driver_register(&hp100_eisa_driver);
+ if (err && err != -ENODEV)
+ goto out2;
+-#endif
+-#ifdef CONFIG_PCI
+ err = pci_register_driver(&hp100_pci_driver);
+ if (err && err != -ENODEV)
+ goto out3;
+-#endif
+ out:
+ return err;
+ out3:
+-#ifdef CONFIG_EISA
+ eisa_driver_unregister (&hp100_eisa_driver);
+ out2:
+-#endif
+ hp100_isa_cleanup();
+ goto out;
+ }
+@@ -3057,12 +3043,8 @@ static int __init hp100_module_init(void
+ static void __exit hp100_module_exit(void)
+ {
+ hp100_isa_cleanup();
+-#ifdef CONFIG_EISA
+ eisa_driver_unregister (&hp100_eisa_driver);
+-#endif
+-#ifdef CONFIG_PCI
+ pci_unregister_driver (&hp100_pci_driver);
+-#endif
+ }
+
+ module_init(hp100_module_init)
--- /dev/null
+From f6ca9f46f6615c3a87529550058d1b468c0cad89 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Wed, 27 Jan 2016 14:52:01 +0100
+Subject: netfilter: ipvs: avoid unused variable warnings
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit f6ca9f46f6615c3a87529550058d1b468c0cad89 upstream.
+
+The proc_create() and remove_proc_entry() functions do not reference
+their arguments when CONFIG_PROC_FS is disabled, so we get a couple
+of warnings about unused variables in IPVS:
+
+ipvs/ip_vs_app.c:608:14: warning: unused variable 'net' [-Wunused-variable]
+ipvs/ip_vs_ctl.c:3950:14: warning: unused variable 'net' [-Wunused-variable]
+ipvs/ip_vs_ctl.c:3994:14: warning: unused variable 'net' [-Wunused-variable]
+
+This removes the local variables and instead looks them up separately
+for each use, which obviously avoids the warning.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Fixes: 4c50a8ce2b63 ("netfilter: ipvs: avoid unused variable warning")
+Acked-by: Julian Anastasov <ja@ssi.bg>
+Signed-off-by: Simon Horman <horms@verge.net.au>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ net/netfilter/ipvs/ip_vs_app.c | 8 ++------
+ net/netfilter/ipvs/ip_vs_ctl.c | 15 ++++++---------
+ 2 files changed, 8 insertions(+), 15 deletions(-)
+
+--- a/net/netfilter/ipvs/ip_vs_app.c
++++ b/net/netfilter/ipvs/ip_vs_app.c
+@@ -605,17 +605,13 @@ static const struct file_operations ip_v
+
+ int __net_init ip_vs_app_net_init(struct netns_ipvs *ipvs)
+ {
+- struct net *net = ipvs->net;
+-
+ INIT_LIST_HEAD(&ipvs->app_list);
+- proc_create("ip_vs_app", 0, net->proc_net, &ip_vs_app_fops);
++ proc_create("ip_vs_app", 0, ipvs->net->proc_net, &ip_vs_app_fops);
+ return 0;
+ }
+
+ void __net_exit ip_vs_app_net_cleanup(struct netns_ipvs *ipvs)
+ {
+- struct net *net = ipvs->net;
+-
+ unregister_ip_vs_app(ipvs, NULL /* all */);
+- remove_proc_entry("ip_vs_app", net->proc_net);
++ remove_proc_entry("ip_vs_app", ipvs->net->proc_net);
+ }
+--- a/net/netfilter/ipvs/ip_vs_ctl.c
++++ b/net/netfilter/ipvs/ip_vs_ctl.c
+@@ -3951,7 +3951,6 @@ static struct notifier_block ip_vs_dst_n
+
+ int __net_init ip_vs_control_net_init(struct netns_ipvs *ipvs)
+ {
+- struct net *net = ipvs->net;
+ int i, idx;
+
+ /* Initialize rs_table */
+@@ -3978,9 +3977,9 @@ int __net_init ip_vs_control_net_init(st
+
+ spin_lock_init(&ipvs->tot_stats.lock);
+
+- proc_create("ip_vs", 0, net->proc_net, &ip_vs_info_fops);
+- proc_create("ip_vs_stats", 0, net->proc_net, &ip_vs_stats_fops);
+- proc_create("ip_vs_stats_percpu", 0, net->proc_net,
++ proc_create("ip_vs", 0, ipvs->net->proc_net, &ip_vs_info_fops);
++ proc_create("ip_vs_stats", 0, ipvs->net->proc_net, &ip_vs_stats_fops);
++ proc_create("ip_vs_stats_percpu", 0, ipvs->net->proc_net,
+ &ip_vs_stats_percpu_fops);
+
+ if (ip_vs_control_net_init_sysctl(ipvs))
+@@ -3995,13 +3994,11 @@ err:
+
+ void __net_exit ip_vs_control_net_cleanup(struct netns_ipvs *ipvs)
+ {
+- struct net *net = ipvs->net;
+-
+ ip_vs_trash_cleanup(ipvs);
+ ip_vs_control_net_cleanup_sysctl(ipvs);
+- remove_proc_entry("ip_vs_stats_percpu", net->proc_net);
+- remove_proc_entry("ip_vs_stats", net->proc_net);
+- remove_proc_entry("ip_vs", net->proc_net);
++ remove_proc_entry("ip_vs_stats_percpu", ipvs->net->proc_net);
++ remove_proc_entry("ip_vs_stats", ipvs->net->proc_net);
++ remove_proc_entry("ip_vs", ipvs->net->proc_net);
+ free_percpu(ipvs->tot_stats.cpustats);
+ }
+
--- /dev/null
+From foo@baz Fri Feb 23 17:12:49 CET 2018
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Tue, 20 Feb 2018 12:54:58 +0100
+Subject: netlink: fix nla_put_{u8,u16,u32} for KASAN
+To: stable@vger.kernel.org
+Cc: Greg KH <gregkh@linuxfoundation.org>, linux-kernel@vger.kernel.org, Arnd Bergmann <arnd@arndb.de>, "David S . Miller" <davem@davemloft.net>, netdev@vger.kernel.org
+Message-ID: <20180220115527.1806578-12-arnd@arndb.de>
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit b4391db42308c9940944b5d7be5ca4b78fb88dd0 upstream.
+
+When CONFIG_KASAN is enabled, the "--param asan-stack=1" causes rather large
+stack frames in some functions. This goes unnoticed normally because
+CONFIG_FRAME_WARN is disabled with CONFIG_KASAN by default as of commit
+3f181b4d8652 ("lib/Kconfig.debug: disable -Wframe-larger-than warnings with
+KASAN=y").
+
+The kernelci.org build bot however has the warning enabled and that led
+me to investigate it a little further, as every build produces these warnings:
+
+net/wireless/nl80211.c:4389:1: warning: the frame size of 2240 bytes is larger than 2048 bytes [-Wframe-larger-than=]
+net/wireless/nl80211.c:1895:1: warning: the frame size of 3776 bytes is larger than 2048 bytes [-Wframe-larger-than=]
+net/wireless/nl80211.c:1410:1: warning: the frame size of 2208 bytes is larger than 2048 bytes [-Wframe-larger-than=]
+net/bridge/br_netlink.c:1282:1: warning: the frame size of 2544 bytes is larger than 2048 bytes [-Wframe-larger-than=]
+
+Most of this problem is now solved in gcc-8, which can consolidate
+the stack slots for the inline function arguments. On older compilers
+we can add a workaround by declaring a local variable in each function
+to pass the inline function argument.
+
+Cc: stable@vger.kernel.org
+Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81715
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+[arnd: rebased to 4.4-stable]
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ include/net/netlink.h | 73 +++++++++++++++++++++++++++++++++++++-------------
+ 1 file changed, 55 insertions(+), 18 deletions(-)
+
+--- a/include/net/netlink.h
++++ b/include/net/netlink.h
+@@ -745,7 +745,10 @@ static inline int nla_parse_nested(struc
+ */
+ static inline int nla_put_u8(struct sk_buff *skb, int attrtype, u8 value)
+ {
+- return nla_put(skb, attrtype, sizeof(u8), &value);
++ /* temporary variables to work around GCC PR81715 with asan-stack=1 */
++ u8 tmp = value;
++
++ return nla_put(skb, attrtype, sizeof(u8), &tmp);
+ }
+
+ /**
+@@ -756,7 +759,9 @@ static inline int nla_put_u8(struct sk_b
+ */
+ static inline int nla_put_u16(struct sk_buff *skb, int attrtype, u16 value)
+ {
+- return nla_put(skb, attrtype, sizeof(u16), &value);
++ u16 tmp = value;
++
++ return nla_put(skb, attrtype, sizeof(u16), &tmp);
+ }
+
+ /**
+@@ -767,7 +772,9 @@ static inline int nla_put_u16(struct sk_
+ */
+ static inline int nla_put_be16(struct sk_buff *skb, int attrtype, __be16 value)
+ {
+- return nla_put(skb, attrtype, sizeof(__be16), &value);
++ __be16 tmp = value;
++
++ return nla_put(skb, attrtype, sizeof(__be16), &tmp);
+ }
+
+ /**
+@@ -778,7 +785,9 @@ static inline int nla_put_be16(struct sk
+ */
+ static inline int nla_put_net16(struct sk_buff *skb, int attrtype, __be16 value)
+ {
+- return nla_put_be16(skb, attrtype | NLA_F_NET_BYTEORDER, value);
++ __be16 tmp = value;
++
++ return nla_put_be16(skb, attrtype | NLA_F_NET_BYTEORDER, tmp);
+ }
+
+ /**
+@@ -789,7 +798,9 @@ static inline int nla_put_net16(struct s
+ */
+ static inline int nla_put_le16(struct sk_buff *skb, int attrtype, __le16 value)
+ {
+- return nla_put(skb, attrtype, sizeof(__le16), &value);
++ __le16 tmp = value;
++
++ return nla_put(skb, attrtype, sizeof(__le16), &tmp);
+ }
+
+ /**
+@@ -800,7 +811,9 @@ static inline int nla_put_le16(struct sk
+ */
+ static inline int nla_put_u32(struct sk_buff *skb, int attrtype, u32 value)
+ {
+- return nla_put(skb, attrtype, sizeof(u32), &value);
++ u32 tmp = value;
++
++ return nla_put(skb, attrtype, sizeof(u32), &tmp);
+ }
+
+ /**
+@@ -811,7 +824,9 @@ static inline int nla_put_u32(struct sk_
+ */
+ static inline int nla_put_be32(struct sk_buff *skb, int attrtype, __be32 value)
+ {
+- return nla_put(skb, attrtype, sizeof(__be32), &value);
++ __be32 tmp = value;
++
++ return nla_put(skb, attrtype, sizeof(__be32), &tmp);
+ }
+
+ /**
+@@ -822,7 +837,9 @@ static inline int nla_put_be32(struct sk
+ */
+ static inline int nla_put_net32(struct sk_buff *skb, int attrtype, __be32 value)
+ {
+- return nla_put_be32(skb, attrtype | NLA_F_NET_BYTEORDER, value);
++ __be32 tmp = value;
++
++ return nla_put_be32(skb, attrtype | NLA_F_NET_BYTEORDER, tmp);
+ }
+
+ /**
+@@ -833,7 +850,9 @@ static inline int nla_put_net32(struct s
+ */
+ static inline int nla_put_le32(struct sk_buff *skb, int attrtype, __le32 value)
+ {
+- return nla_put(skb, attrtype, sizeof(__le32), &value);
++ __le32 tmp = value;
++
++ return nla_put(skb, attrtype, sizeof(__le32), &tmp);
+ }
+
+ /**
+@@ -844,7 +863,9 @@ static inline int nla_put_le32(struct sk
+ */
+ static inline int nla_put_u64(struct sk_buff *skb, int attrtype, u64 value)
+ {
+- return nla_put(skb, attrtype, sizeof(u64), &value);
++ u64 tmp = value;
++
++ return nla_put(skb, attrtype, sizeof(u64), &tmp);
+ }
+
+ /**
+@@ -855,7 +876,9 @@ static inline int nla_put_u64(struct sk_
+ */
+ static inline int nla_put_be64(struct sk_buff *skb, int attrtype, __be64 value)
+ {
+- return nla_put(skb, attrtype, sizeof(__be64), &value);
++ __be64 tmp = value;
++
++ return nla_put(skb, attrtype, sizeof(__be64), &tmp);
+ }
+
+ /**
+@@ -866,7 +889,9 @@ static inline int nla_put_be64(struct sk
+ */
+ static inline int nla_put_net64(struct sk_buff *skb, int attrtype, __be64 value)
+ {
+- return nla_put_be64(skb, attrtype | NLA_F_NET_BYTEORDER, value);
++ __be64 tmp = value;
++
++ return nla_put_be64(skb, attrtype | NLA_F_NET_BYTEORDER, tmp);
+ }
+
+ /**
+@@ -877,7 +902,9 @@ static inline int nla_put_net64(struct s
+ */
+ static inline int nla_put_le64(struct sk_buff *skb, int attrtype, __le64 value)
+ {
+- return nla_put(skb, attrtype, sizeof(__le64), &value);
++ __le64 tmp = value;
++
++ return nla_put(skb, attrtype, sizeof(__le64), &tmp);
+ }
+
+ /**
+@@ -888,7 +915,9 @@ static inline int nla_put_le64(struct sk
+ */
+ static inline int nla_put_s8(struct sk_buff *skb, int attrtype, s8 value)
+ {
+- return nla_put(skb, attrtype, sizeof(s8), &value);
++ s8 tmp = value;
++
++ return nla_put(skb, attrtype, sizeof(s8), &tmp);
+ }
+
+ /**
+@@ -899,7 +928,9 @@ static inline int nla_put_s8(struct sk_b
+ */
+ static inline int nla_put_s16(struct sk_buff *skb, int attrtype, s16 value)
+ {
+- return nla_put(skb, attrtype, sizeof(s16), &value);
++ s16 tmp = value;
++
++ return nla_put(skb, attrtype, sizeof(s16), &tmp);
+ }
+
+ /**
+@@ -910,7 +941,9 @@ static inline int nla_put_s16(struct sk_
+ */
+ static inline int nla_put_s32(struct sk_buff *skb, int attrtype, s32 value)
+ {
+- return nla_put(skb, attrtype, sizeof(s32), &value);
++ s32 tmp = value;
++
++ return nla_put(skb, attrtype, sizeof(s32), &tmp);
+ }
+
+ /**
+@@ -921,7 +954,9 @@ static inline int nla_put_s32(struct sk_
+ */
+ static inline int nla_put_s64(struct sk_buff *skb, int attrtype, s64 value)
+ {
+- return nla_put(skb, attrtype, sizeof(s64), &value);
++ s64 tmp = value;
++
++ return nla_put(skb, attrtype, sizeof(s64), &tmp);
+ }
+
+ /**
+@@ -969,7 +1004,9 @@ static inline int nla_put_msecs(struct s
+ static inline int nla_put_in_addr(struct sk_buff *skb, int attrtype,
+ __be32 addr)
+ {
+- return nla_put_be32(skb, attrtype, addr);
++ __be32 tmp = addr;
++
++ return nla_put_be32(skb, attrtype, tmp);
+ }
+
+ /**
--- /dev/null
+From foo@baz Fri Feb 23 17:23:58 CET 2018
+From: Jack Wang <jinpu.wang@profitbricks.com>
+Date: Fri, 23 Feb 2018 11:42:06 +0100
+Subject: nl80211: Sanitize array index in parse_txq_params
+To: gregkh@linuxfoundation.org, stable@vger.kernel.org
+Cc: Dan Williams <dan.j.williams@intel.com>, Thomas Gleixner <tglx@linutronix.de>, linux-arch@vger.kernel.org, kernel-hardening@lists.openwall.com, linux-wireless@vger.kernel.org, torvalds@linux-foundation.org, "David S. Miller" <davem@davemloft.net>, alan@linux.intel.com, David Woodhouse <dwmw@amazon.co.uk>, Jack Wang <jinpu.wang@profitbricks.com>
+Message-ID: <1519382538-15143-18-git-send-email-jinpu.wangl@profitbricks.com>
+
+From: Dan Williams <dan.j.williams@intel.com>
+
+(cherry picked from commit 259d8c1e984318497c84eef547bbb6b1d9f4eb05)
+
+Wireless drivers rely on parse_txq_params to validate that txq_params->ac
+is less than NL80211_NUM_ACS by the time the low-level driver's ->conf_tx()
+handler is called. Use a new helper, array_index_nospec(), to sanitize
+txq_params->ac with respect to speculation. I.e. ensure that any
+speculation into ->conf_tx() handlers is done with a value of
+txq_params->ac that is within the bounds of [0, NL80211_NUM_ACS).
+
+Reported-by: Christian Lamparter <chunkeey@gmail.com>
+Reported-by: Elena Reshetova <elena.reshetova@intel.com>
+Signed-off-by: Dan Williams <dan.j.williams@intel.com>
+Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
+Acked-by: Johannes Berg <johannes@sipsolutions.net>
+Cc: linux-arch@vger.kernel.org
+Cc: kernel-hardening@lists.openwall.com
+Cc: gregkh@linuxfoundation.org
+Cc: linux-wireless@vger.kernel.org
+Cc: torvalds@linux-foundation.org
+Cc: "David S. Miller" <davem@davemloft.net>
+Cc: alan@linux.intel.com
+Link: https://lkml.kernel.org/r/151727419584.33451.7700736761686184303.stgit@dwillia2-desk3.amr.corp.intel.com
+Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
+[jwang: cherry pick to 4.4]
+Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ net/wireless/nl80211.c | 9 ++++++---
+ 1 file changed, 6 insertions(+), 3 deletions(-)
+
+--- a/net/wireless/nl80211.c
++++ b/net/wireless/nl80211.c
+@@ -16,6 +16,7 @@
+ #include <linux/nl80211.h>
+ #include <linux/rtnetlink.h>
+ #include <linux/netlink.h>
++#include <linux/nospec.h>
+ #include <linux/etherdevice.h>
+ #include <net/net_namespace.h>
+ #include <net/genetlink.h>
+@@ -1879,20 +1880,22 @@ static const struct nla_policy txq_param
+ static int parse_txq_params(struct nlattr *tb[],
+ struct ieee80211_txq_params *txq_params)
+ {
++ u8 ac;
++
+ if (!tb[NL80211_TXQ_ATTR_AC] || !tb[NL80211_TXQ_ATTR_TXOP] ||
+ !tb[NL80211_TXQ_ATTR_CWMIN] || !tb[NL80211_TXQ_ATTR_CWMAX] ||
+ !tb[NL80211_TXQ_ATTR_AIFS])
+ return -EINVAL;
+
+- txq_params->ac = nla_get_u8(tb[NL80211_TXQ_ATTR_AC]);
++ ac = nla_get_u8(tb[NL80211_TXQ_ATTR_AC]);
+ txq_params->txop = nla_get_u16(tb[NL80211_TXQ_ATTR_TXOP]);
+ txq_params->cwmin = nla_get_u16(tb[NL80211_TXQ_ATTR_CWMIN]);
+ txq_params->cwmax = nla_get_u16(tb[NL80211_TXQ_ATTR_CWMAX]);
+ txq_params->aifs = nla_get_u8(tb[NL80211_TXQ_ATTR_AIFS]);
+
+- if (txq_params->ac >= NL80211_NUM_ACS)
++ if (ac >= NL80211_NUM_ACS)
+ return -EINVAL;
+-
++ txq_params->ac = array_index_nospec(ac, NL80211_NUM_ACS);
+ return 0;
+ }
+
--- /dev/null
+From 11d8b05855f3749bcb6c57e2c4052921b9605c77 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Wed, 19 Jul 2017 14:52:59 +0200
+Subject: perf/x86: Shut up false-positive -Wmaybe-uninitialized warning
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit 11d8b05855f3749bcb6c57e2c4052921b9605c77 upstream.
+
+The intialization function checks for various failure scenarios, but
+unfortunately the compiler gets a little confused about the possible
+combinations, leading to a false-positive build warning when
+-Wmaybe-uninitialized is set:
+
+ arch/x86/events/core.c: In function ‘init_hw_perf_events’:
+ arch/x86/events/core.c:264:3: warning: ‘reg_fail’ may be used uninitialized in this function [-Wmaybe-uninitialized]
+ arch/x86/events/core.c:264:3: warning: ‘val_fail’ may be used uninitialized in this function [-Wmaybe-uninitialized]
+ pr_err(FW_BUG "the BIOS has corrupted hw-PMU resources (MSR %x is %Lx)\n",
+
+We can't actually run into this case, so this shuts up the warning
+by initializing the variables to a known-invalid state.
+
+Suggested-by: Peter Zijlstra <peterz@infradead.org>
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
+Cc: Andy Lutomirski <luto@kernel.org>
+Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
+Cc: Josh Poimboeuf <jpoimboe@redhat.com>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Link: http://lkml.kernel.org/r/20170719125310.2487451-2-arnd@arndb.de
+Link: https://patchwork.kernel.org/patch/9392595/
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/x86/kernel/cpu/perf_event.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/arch/x86/kernel/cpu/perf_event.c
++++ b/arch/x86/kernel/cpu/perf_event.c
+@@ -188,8 +188,8 @@ static void release_pmc_hardware(void) {
+
+ static bool check_hw_exists(void)
+ {
+- u64 val, val_fail, val_new= ~0;
+- int i, reg, reg_fail, ret = 0;
++ u64 val, val_fail = -1, val_new= ~0;
++ int i, reg, reg_fail = -1, ret = 0;
+ int bios_fail = 0;
+ int reg_safe = -1;
+
--- /dev/null
+From b4aca383f9afb5f84b05de272656e6d4a919d995 Mon Sep 17 00:00:00 2001
+From: Borislav Petkov <bp@suse.de>
+Date: Sat, 26 Nov 2016 17:01:51 +0100
+Subject: platform/x86: intel_mid_thermal: Fix suspend handlers unused warning
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Borislav Petkov <bp@suse.de>
+
+commit b4aca383f9afb5f84b05de272656e6d4a919d995 upstream.
+
+Fix:
+
+ drivers/platform/x86/intel_mid_thermal.c:424:12: warning: ‘mid_thermal_resume’
+ defined but not used [-Wunused-function]
+ static int mid_thermal_resume(struct device *dev)
+ ^
+ drivers/platform/x86/intel_mid_thermal.c:436:12: warning: ‘mid_thermal_suspend’
+ defined but not used [-Wunused-function]
+ static int mid_thermal_suspend(struct device *dev)
+ ^
+
+which I see during randbuilds here.
+
+Signed-off-by: Borislav Petkov <bp@suse.de>
+Cc: Darren Hart <dvhart@infradead.org>
+Cc: platform-driver-x86@vger.kernel.org
+Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
+Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/platform/x86/intel_mid_thermal.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/drivers/platform/x86/intel_mid_thermal.c
++++ b/drivers/platform/x86/intel_mid_thermal.c
+@@ -415,6 +415,7 @@ static struct thermal_device_info *initi
+ return td_info;
+ }
+
++#ifdef CONFIG_PM_SLEEP
+ /**
+ * mid_thermal_resume - resume routine
+ * @dev: device structure
+@@ -442,6 +443,7 @@ static int mid_thermal_suspend(struct de
+ */
+ return configure_adc(0);
+ }
++#endif
+
+ static SIMPLE_DEV_PM_OPS(mid_thermal_pm,
+ mid_thermal_suspend, mid_thermal_resume);
--- /dev/null
+From foo@baz Fri Feb 23 17:12:49 CET 2018
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Tue, 20 Feb 2018 12:54:50 +0100
+Subject: power: bq27xxx_battery: mark some symbols __maybe_unused
+To: stable@vger.kernel.org
+Cc: "Greg KH" <gregkh@linuxfoundation.org>, linux-kernel@vger.kernel.org, "Arnd Bergmann" <arnd@arndb.de>, "Pali Rohár" <pali.rohar@gmail.com>, "Sebastian Reichel" <sre@kernel.org>, "Dmitry Eremin-Solenikov" <dbaryshkov@gmail.com>, "David Woodhouse" <dwmw2@infradead.org>, linux-pm@vger.kernel.org
+Message-ID: <20180220115527.1806578-4-arnd@arndb.de>
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+Without the I2C driver, we get a few warnings:
+
+drivers/power/bq27xxx_battery.c:288:12: error: 'bq27xxx_regs' defined but not used [-Werror=unused-variable]
+ static u8 *bq27xxx_regs[] = {
+ ^
+drivers/power/bq27xxx_battery.c:994:12: error: 'bq27xxx_powersupply_init' defined but not used [-Werror=unused-function]
+ static int bq27xxx_powersupply_init(struct bq27xxx_device_info *di,
+ ^
+drivers/power/bq27xxx_battery.c:1029:13: error: 'bq27xxx_powersupply_unregister' defined but not used [-Werror=unused-function]
+ static void bq27xxx_powersupply_unregister(struct bq27xxx_device_info *di)
+ ^
+
+In mainline kernels, this was addressed by a larger rework in 703df6c09795 ("power:
+bq27xxx_battery: Reorganize I2C into a module"). We probably don't want this backported
+into stable kernels, so instead let's shut up the warnings by marking the symbols
+as __maybe_unused.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/power/bq27xxx_battery.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+--- a/drivers/power/bq27xxx_battery.c
++++ b/drivers/power/bq27xxx_battery.c
+@@ -285,7 +285,7 @@ static u8 bq27421_regs[] = {
+ 0x18, /* AP */
+ };
+
+-static u8 *bq27xxx_regs[] = {
++static u8 *bq27xxx_regs[] __maybe_unused = {
+ [BQ27000] = bq27000_regs,
+ [BQ27010] = bq27010_regs,
+ [BQ27500] = bq27500_regs,
+@@ -991,7 +991,7 @@ static void bq27xxx_external_power_chang
+ schedule_delayed_work(&di->work, 0);
+ }
+
+-static int bq27xxx_powersupply_init(struct bq27xxx_device_info *di,
++static int __maybe_unused bq27xxx_powersupply_init(struct bq27xxx_device_info *di,
+ const char *name)
+ {
+ int ret;
+@@ -1026,7 +1026,7 @@ static int bq27xxx_powersupply_init(stru
+ return 0;
+ }
+
+-static void bq27xxx_powersupply_unregister(struct bq27xxx_device_info *di)
++static void __maybe_unused bq27xxx_powersupply_unregister(struct bq27xxx_device_info *di)
+ {
+ /*
+ * power_supply_unregister call bq27xxx_battery_get_property which
--- /dev/null
+From ade356b99a4187578609f2a91c4d2ed88e4e70dc Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Tue, 22 Mar 2016 14:27:26 -0700
+Subject: profile: hide unused functions when !CONFIG_PROC_FS
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit ade356b99a4187578609f2a91c4d2ed88e4e70dc upstream.
+
+A couple of functions and variables in the profile implementation are
+used only on SMP systems by the procfs code, but are unused if either
+procfs is disabled or in uniprocessor kernels. gcc prints a harmless
+warning about the unused symbols:
+
+ kernel/profile.c:243:13: error: 'profile_flip_buffers' defined but not used [-Werror=unused-function]
+ static void profile_flip_buffers(void)
+ ^
+ kernel/profile.c:266:13: error: 'profile_discard_flip_buffers' defined but not used [-Werror=unused-function]
+ static void profile_discard_flip_buffers(void)
+ ^
+ kernel/profile.c:330:12: error: 'profile_cpu_callback' defined but not used [-Werror=unused-function]
+ static int profile_cpu_callback(struct notifier_block *info,
+ ^
+
+This adds further #ifdef to the file, to annotate exactly in which cases
+they are used. I have done several thousand ARM randconfig kernels with
+this patch applied and no longer get any warnings in this file.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Cc: Vlastimil Babka <vbabka@suse.cz>
+Cc: Robin Holt <robinmholt@gmail.com>
+Cc: Johannes Weiner <hannes@cmpxchg.org>
+Cc: Christoph Lameter <cl@linux.com>
+Cc: Tejun Heo <tj@kernel.org>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ kernel/profile.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/kernel/profile.c
++++ b/kernel/profile.c
+@@ -44,7 +44,7 @@ int prof_on __read_mostly;
+ EXPORT_SYMBOL_GPL(prof_on);
+
+ static cpumask_var_t prof_cpu_mask;
+-#ifdef CONFIG_SMP
++#if defined(CONFIG_SMP) && defined(CONFIG_PROC_FS)
+ static DEFINE_PER_CPU(struct profile_hit *[2], cpu_profile_hits);
+ static DEFINE_PER_CPU(int, cpu_profile_flip);
+ static DEFINE_MUTEX(profile_flip_mutex);
+@@ -201,7 +201,7 @@ int profile_event_unregister(enum profil
+ }
+ EXPORT_SYMBOL_GPL(profile_event_unregister);
+
+-#ifdef CONFIG_SMP
++#if defined(CONFIG_SMP) && defined(CONFIG_PROC_FS)
+ /*
+ * Each cpu has a pair of open-addressed hashtables for pending
+ * profile hits. read_profile() IPI's all cpus to request them
--- /dev/null
+From 1f6bcd011464cb36059e2562f72baf75f98b732d Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Tue, 26 Jan 2016 14:17:24 -0200
+Subject: [media] pwc: hide unused label
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit 1f6bcd011464cb36059e2562f72baf75f98b732d upstream.
+
+The pwc driver causes a warning when CONFIG_USB_PWC_INPUT_EVDEV is unset:
+
+drivers/media/usb/pwc/pwc-if.c: In function 'usb_pwc_probe':
+drivers/media/usb/pwc/pwc-if.c:1115:1: warning: label 'err_video_unreg' defined but not used [-Wunused-label]
+
+This moves the unused label and code inside another #ifdef to
+get rid of the warning.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
+Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/media/usb/pwc/pwc-if.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/drivers/media/usb/pwc/pwc-if.c
++++ b/drivers/media/usb/pwc/pwc-if.c
+@@ -1119,8 +1119,10 @@ static int usb_pwc_probe(struct usb_inte
+
+ return 0;
+
++#ifdef CONFIG_USB_PWC_INPUT_EVDEV
+ err_video_unreg:
+ video_unregister_device(&pdev->vdev);
++#endif
+ err_unregister_v4l2_dev:
+ v4l2_device_unregister(&pdev->v4l2_dev);
+ err_free_controls:
--- /dev/null
+From ab4949640d6674b617b314ad3c2c00353304bab9 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Thu, 23 Mar 2017 16:06:13 +0100
+Subject: reiserfs: avoid a -Wmaybe-uninitialized warning
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit ab4949640d6674b617b314ad3c2c00353304bab9 upstream.
+
+The latest gcc-7.0.1 snapshot warns about an unintialized variable use:
+
+In file included from fs/reiserfs/lbalance.c:8:0:
+fs/reiserfs/lbalance.c: In function 'leaf_item_bottle.isra.3':
+fs/reiserfs/reiserfs.h:1279:13: error: '*((void *)&n_ih+8).v' may be used uninitialized in this function [-Werror=maybe-uninitialized]
+ v2->v = (v2->v & cpu_to_le64(15ULL << 60)) | cpu_to_le64(offset);
+ ~~^~~
+fs/reiserfs/reiserfs.h:1279:13: error: '*((void *)&n_ih+8).v' may be used uninitialized in this function [-Werror=maybe-uninitialized]
+ v2->v = (v2->v & cpu_to_le64(15ULL << 60)) | cpu_to_le64(offset);
+
+This happens because the offset/type pair that is stored in
+ih.key.u.k_offset_v2 is actually uninitialized when we call
+set_le_ih_k_offset() and set_le_ih_k_type(). After we have called both,
+all data is correct, but the first of the two reads uninitialized data
+for the type field and writes it back before it gets overwritten.
+
+This works around the warning by initializing the k_offset_v2 through
+the slightly larger memcpy().
+
+[JK: Remove now unused define and make it obvious we initialize the key]
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Jan Kara <jack@suse.cz>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/reiserfs/lbalance.c | 2 +-
+ fs/reiserfs/reiserfs.h | 1 -
+ 2 files changed, 1 insertion(+), 2 deletions(-)
+
+--- a/fs/reiserfs/lbalance.c
++++ b/fs/reiserfs/lbalance.c
+@@ -475,7 +475,7 @@ static void leaf_item_bottle(struct buff
+ * 'cpy_bytes'; create new item header;
+ * n_ih = new item_header;
+ */
+- memcpy(&n_ih, ih, SHORT_KEY_SIZE);
++ memcpy(&n_ih.ih_key, &ih->ih_key, KEY_SIZE);
+
+ /* Endian safe, both le */
+ n_ih.ih_version = ih->ih_version;
+--- a/fs/reiserfs/reiserfs.h
++++ b/fs/reiserfs/reiserfs.h
+@@ -1326,7 +1326,6 @@ struct cpu_key {
+ #define KEY_NOT_FOUND 0
+
+ #define KEY_SIZE (sizeof(struct reiserfs_key))
+-#define SHORT_KEY_SIZE (sizeof (__u32) + sizeof (__u32))
+
+ /* return values for search_by_key and clones */
+ #define ITEM_FOUND 1
--- /dev/null
+From foo@baz Fri Feb 23 17:12:49 CET 2018
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Tue, 20 Feb 2018 12:54:49 +0100
+Subject: Revert "power: bq27xxx_battery: Remove unneeded dependency in Kconfig"
+To: stable@vger.kernel.org
+Cc: Greg KH <gregkh@linuxfoundation.org>, linux-kernel@vger.kernel.org, Arnd Bergmann <arnd@arndb.de>, Sebastian Reichel <sre@kernel.org>, Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>, David Woodhouse <dwmw2@infradead.org>, linux-pm@vger.kernel.org
+Message-ID: <20180220115527.1806578-3-arnd@arndb.de>
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+This reverts commit 6bd03ce3c12a22d86f59070f1da15aaa2bde8a51, it was applied
+in error and cuased this link failure
+
+drivers/built-in.o: In function `bq27xxx_battery_i2c_read':
+core.c:(.text+0xa6da8): undefined reference to `i2c_transfer'
+drivers/built-in.o: In function `bq27xxx_battery_init':
+core.c:(.init.text+0x68e0): undefined reference to `i2c_register_driver'
+drivers/built-in.o: In function `bq27xxx_battery_exit':
+core.c:(.exit.text+0xc6c): undefined reference to `i2c_del_driver'
+
+Later upstream kernels fixed this with a larger rework in commit
+703df6c09795 ("power: bq27xxx_battery: Reorganize I2C into a module"),
+but we cannot backport that to 4.4.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/power/Kconfig | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/power/Kconfig
++++ b/drivers/power/Kconfig
+@@ -159,6 +159,7 @@ config BATTERY_SBS
+
+ config BATTERY_BQ27XXX
+ tristate "BQ27xxx battery driver"
++ depends on I2C || I2C=n
+ help
+ Say Y here to enable support for batteries with BQ27xxx (I2C/HDQ) chips.
+
--- /dev/null
+From 2acd846485549655582ee379ceb966206f91e6f8 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Thu, 17 Mar 2016 11:03:50 +0100
+Subject: rtlwifi: fix gcc-6 indentation warning
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit 2acd846485549655582ee379ceb966206f91e6f8 upstream.
+
+The rtl8821ae_dm_txpower_tracking_callback_thermalmeter function
+contains a call to RT_TRACE() that is indented in a misleading
+way, as pointed out by a gcc-6 warning:
+
+drivers/net/wireless/realtek/rtlwifi/rtl8821ae/dm.c: In function 'rtl8821ae_dm_txpower_tracking_callback_thermalmeter':
+drivers/net/wireless/realtek/rtlwifi/rtl8821ae/dm.c:2491:4: error: statement is indented as if it were guarded by...
+ RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD,
+ ^~~~~~~~
+drivers/net/wireless/realtek/rtlwifi/rtl8821ae/dm.c:2488:3: note: ...this 'for' clause, but it is not
+ for (p = RF90_PATH_A; p < MAX_PATH_NUM_8821A; p++)
+ ^~~
+
+It is clear from the context that the call was not meant to be
+part of the loop and only the indentation is wrong, so this
+removes the extra tabs.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
+Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/net/wireless/realtek/rtlwifi/rtl8821ae/dm.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+--- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/dm.c
++++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/dm.c
+@@ -2488,9 +2488,9 @@ void rtl8821ae_dm_txpower_tracking_callb
+ for (p = RF90_PATH_A; p < MAX_PATH_NUM_8821A; p++)
+ rtldm->swing_idx_ofdm_base[p] = rtldm->swing_idx_ofdm[p];
+
+- RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD,
+- "pDM_Odm->RFCalibrateInfo.ThermalValue = %d ThermalValue= %d\n",
+- rtldm->thermalvalue, thermal_value);
++ RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD,
++ "pDM_Odm->RFCalibrateInfo.ThermalValue = %d ThermalValue= %d\n",
++ rtldm->thermalvalue, thermal_value);
+ /*Record last Power Tracking Thermal Value*/
+ rtldm->thermalvalue = thermal_value;
+ }
--- /dev/null
+From f46e7cd36b5f2ce2bfb567e278a10ca717f85b84 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Mon, 24 Oct 2016 17:51:55 +0200
+Subject: scsi: advansys: fix build warning for PCI=n
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit f46e7cd36b5f2ce2bfb567e278a10ca717f85b84 upstream.
+
+The advansys probe function tries to handle both ISA and PCI cases, each
+hidden in an #ifdef when unused. This leads to a warning indicating that
+when PCI is disabled we could be using uninitialized data:
+
+drivers/scsi/advansys.c: In function advansys_board_found :
+drivers/scsi/advansys.c:11036:5: error: ret may be used uninitialized in this function [-Werror=maybe-uninitialized]
+drivers/scsi/advansys.c:10928:28: note: ret was declared here
+drivers/scsi/advansys.c:11309:8: error: share_irq may be used uninitialized in this function [-Werror=maybe-uninitialized]
+drivers/scsi/advansys.c:10928:6: note: share_irq was declared here
+
+This cannot happen in practice because the hardware in question only
+exists for PCI, but changing the code to just error out here is better
+for consistency and avoids the warning.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Reviewed-by: Hannes Reinecke <hare@suse.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/scsi/advansys.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+--- a/drivers/scsi/advansys.c
++++ b/drivers/scsi/advansys.c
+@@ -11030,6 +11030,9 @@ static int advansys_board_found(struct S
+ ASC_DBG(2, "AdvInitGetConfig()\n");
+
+ ret = AdvInitGetConfig(pdev, shost) ? -ENODEV : 0;
++#else
++ share_irq = 0;
++ ret = -ENODEV;
+ #endif /* CONFIG_PCI */
+ }
+
--- /dev/null
+From 44a5b977128c0ffff0654392b40f4c2ce72a619b Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Thu, 23 Mar 2017 16:02:18 +0100
+Subject: scsi: advansys: fix uninitialized data access
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit 44a5b977128c0ffff0654392b40f4c2ce72a619b upstream.
+
+gcc-7.0.1 now warns about a previously unnoticed access of uninitialized
+struct members:
+
+drivers/scsi/advansys.c: In function 'AscMsgOutSDTR':
+drivers/scsi/advansys.c:3860:26: error: '*((void *)&sdtr_buf+5)' may be used uninitialized in this function [-Werror=maybe-uninitialized]
+ ((ushort)s_buffer[i + 1] << 8) | s_buffer[i]);
+ ^
+drivers/scsi/advansys.c:3860:26: error: '*((void *)&sdtr_buf+7)' may be used uninitialized in this function [-Werror=maybe-uninitialized]
+drivers/scsi/advansys.c:3860:26: error: '*((void *)&sdtr_buf+5)' may be used uninitialized in this function [-Werror=maybe-uninitialized]
+drivers/scsi/advansys.c:3860:26: error: '*((void *)&sdtr_buf+7)' may be used uninitialized in this function [-Werror=maybe-uninitialized]
+
+The code has existed in this exact form at least since v2.6.12, and the
+warning seems correct. This uses named initializers to ensure we
+initialize all members of the structure.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/scsi/advansys.c | 21 ++++++++++-----------
+ 1 file changed, 10 insertions(+), 11 deletions(-)
+
+--- a/drivers/scsi/advansys.c
++++ b/drivers/scsi/advansys.c
+@@ -6291,18 +6291,17 @@ static uchar AscGetSynPeriodIndex(ASC_DV
+ static uchar
+ AscMsgOutSDTR(ASC_DVC_VAR *asc_dvc, uchar sdtr_period, uchar sdtr_offset)
+ {
+- EXT_MSG sdtr_buf;
+- uchar sdtr_period_index;
+- PortAddr iop_base;
+-
+- iop_base = asc_dvc->iop_base;
+- sdtr_buf.msg_type = EXTENDED_MESSAGE;
+- sdtr_buf.msg_len = MS_SDTR_LEN;
+- sdtr_buf.msg_req = EXTENDED_SDTR;
+- sdtr_buf.xfer_period = sdtr_period;
++ PortAddr iop_base = asc_dvc->iop_base;
++ uchar sdtr_period_index = AscGetSynPeriodIndex(asc_dvc, sdtr_period);
++ EXT_MSG sdtr_buf = {
++ .msg_type = EXTENDED_MESSAGE,
++ .msg_len = MS_SDTR_LEN,
++ .msg_req = EXTENDED_SDTR,
++ .xfer_period = sdtr_period,
++ .req_ack_offset = sdtr_offset,
++ };
+ sdtr_offset &= ASC_SYN_MAX_OFFSET;
+- sdtr_buf.req_ack_offset = sdtr_offset;
+- sdtr_period_index = AscGetSynPeriodIndex(asc_dvc, sdtr_period);
++
+ if (sdtr_period_index <= asc_dvc->max_sdtr_index) {
+ AscMemWordCopyPtrToLram(iop_base, ASCV_MSGOUT_BEG,
+ (uchar *)&sdtr_buf,
--- /dev/null
+From 120f83f8d6f2e2e7dea3570646722c62ecee70b0 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Wed, 27 Jan 2016 16:57:17 +0100
+Subject: scsi: fdomain: drop fdomain_pci_tbl when built-in
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit 120f83f8d6f2e2e7dea3570646722c62ecee70b0 upstream.
+
+The fdomain SCSI host driver is one of the last remaining drivers that
+manually search the PCI bus using pci_get_device rather than registering
+a pci_driver instance.
+
+This means the module device table is unused when the driver is
+built-in, and we get a warning about it:
+
+drivers/scsi/fdomain.c:1773:29: warning: 'fdomain_pci_tbl' defined but not used [-Wunused-variable]
+
+To avoid the warning, this adds another #ifdef around the table
+definition.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/scsi/fdomain.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/scsi/fdomain.c
++++ b/drivers/scsi/fdomain.c
+@@ -1768,7 +1768,7 @@ struct scsi_host_template fdomain_driver
+ };
+
+ #ifndef PCMCIA
+-#ifdef CONFIG_PCI
++#if defined(CONFIG_PCI) && defined(MODULE)
+
+ static struct pci_device_id fdomain_pci_tbl[] = {
+ { PCI_VENDOR_ID_FD, PCI_DEVICE_ID_FD_36C70,
--- /dev/null
+From d282e2b383e3f41a7758e8cbf3076091ef9d9447 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Thu, 19 Nov 2015 15:33:41 +0100
+Subject: SCSI: initio: remove duplicate module device table
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit d282e2b383e3f41a7758e8cbf3076091ef9d9447 upstream.
+
+The initio driver has for many years had two copies of the
+same module device table. One of them is also used for registering
+the other driver, the other one is entirely useless after the
+large scale cleanup that Alan Cox did back in 2007.
+
+The compiler warns about this whenever the driver is built-in:
+
+drivers/scsi/initio.c:131:29: warning: 'i91u_pci_devices' defined but not used [-Wunused-variable]
+
+This removes the extraneous table and the warning.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Fixes: 72d39fea901 ("[SCSI] initio: Convert into a real Linux driver and update to modern style")
+Reviewed-by: Christoph Hellwig <hch@lst.de>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/scsi/initio.c | 16 ----------------
+ 1 file changed, 16 deletions(-)
+
+--- a/drivers/scsi/initio.c
++++ b/drivers/scsi/initio.c
+@@ -110,11 +110,6 @@
+ #define i91u_MAXQUEUE 2
+ #define i91u_REVID "Initio INI-9X00U/UW SCSI device driver; Revision: 1.04a"
+
+-#define I950_DEVICE_ID 0x9500 /* Initio's inic-950 product ID */
+-#define I940_DEVICE_ID 0x9400 /* Initio's inic-940 product ID */
+-#define I935_DEVICE_ID 0x9401 /* Initio's inic-935 product ID */
+-#define I920_DEVICE_ID 0x0002 /* Initio's other product ID */
+-
+ #ifdef DEBUG_i91u
+ static unsigned int i91u_debug = DEBUG_DEFAULT;
+ #endif
+@@ -127,17 +122,6 @@ static int setup_debug = 0;
+
+ static void i91uSCBPost(u8 * pHcb, u8 * pScb);
+
+-/* PCI Devices supported by this driver */
+-static struct pci_device_id i91u_pci_devices[] = {
+- { PCI_VENDOR_ID_INIT, I950_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
+- { PCI_VENDOR_ID_INIT, I940_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
+- { PCI_VENDOR_ID_INIT, I935_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
+- { PCI_VENDOR_ID_INIT, I920_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
+- { PCI_VENDOR_ID_DOMEX, I920_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
+- { }
+-};
+-MODULE_DEVICE_TABLE(pci, i91u_pci_devices);
+-
+ #define DEBUG_INTERRUPT 0
+ #define DEBUG_QUEUE 0
+ #define DEBUG_STATE 0
--- /dev/null
+From fddbeb80a904aae41c84ed566e2b0d1de55907df Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Wed, 2 Mar 2016 16:59:00 +0100
+Subject: scsi: mvumi: use __maybe_unused to hide pm functions
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit fddbeb80a904aae41c84ed566e2b0d1de55907df upstream.
+
+The mvumi scsi hides the references to its suspend/resume functions in
+an #ifdef but does not hide the implementation the same way:
+
+drivers/scsi/mvumi.c:2632:12: error: 'mvumi_suspend' defined but not used [-Werror=unused-function]
+drivers/scsi/mvumi.c:2651:12: error: 'mvumi_resume' defined but not used [-Werror=unused-function]
+
+This adds __maybe_unused annotations so the compiler knows it can
+silently drop them instead of warning, while avoiding the addition of
+another #ifdef.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/scsi/mvumi.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/drivers/scsi/mvumi.c
++++ b/drivers/scsi/mvumi.c
+@@ -2629,7 +2629,7 @@ static void mvumi_shutdown(struct pci_de
+ mvumi_flush_cache(mhba);
+ }
+
+-static int mvumi_suspend(struct pci_dev *pdev, pm_message_t state)
++static int __maybe_unused mvumi_suspend(struct pci_dev *pdev, pm_message_t state)
+ {
+ struct mvumi_hba *mhba = NULL;
+
+@@ -2648,7 +2648,7 @@ static int mvumi_suspend(struct pci_dev
+ return 0;
+ }
+
+-static int mvumi_resume(struct pci_dev *pdev)
++static int __maybe_unused mvumi_resume(struct pci_dev *pdev)
+ {
+ int ret;
+ struct mvumi_hba *mhba = NULL;
--- /dev/null
+From 648a0a7da34f281410e8e3a59de8c13ec6ea380a Mon Sep 17 00:00:00 2001
+From: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
+Date: Thu, 11 Feb 2016 10:29:03 +0530
+Subject: scsi: sim710: fix build warning
+
+From: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
+
+commit 648a0a7da34f281410e8e3a59de8c13ec6ea380a upstream.
+
+We are getting build warning about:
+ "Section mismatch in reference from the variable sim710_eisa_driver to
+ the function .init.text:sim710_eisa_probe()
+ The variable sim710_eisa_driver references the function __init
+ sim710_eisa_probe()"
+
+sim710_eisa_probe() was having __init but that was being referenced from
+sim710_eisa_driver.
+
+Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
+Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/scsi/sim710.c | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+--- a/drivers/scsi/sim710.c
++++ b/drivers/scsi/sim710.c
+@@ -176,8 +176,7 @@ static struct eisa_device_id sim710_eisa
+ };
+ MODULE_DEVICE_TABLE(eisa, sim710_eisa_ids);
+
+-static __init int
+-sim710_eisa_probe(struct device *dev)
++static int sim710_eisa_probe(struct device *dev)
+ {
+ struct eisa_device *edev = to_eisa_device(dev);
+ unsigned long io_addr = edev->base_addr;
--- /dev/null
+From 0ff4230584320b2153752ba54e2e8edbd6addf2c Mon Sep 17 00:00:00 2001
+From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
+Date: Thu, 10 Dec 2015 13:26:21 +0200
+Subject: serial: 8250_mid: fix broken DMA dependency
+
+From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
+
+commit 0ff4230584320b2153752ba54e2e8edbd6addf2c upstream.
+
+In order to enable HSU DMA PCI driver, the HSU DMA Engine
+must be enabled. This add a check for that.
+
+Reported-by: kbuild test robot <fengguang.wu@intel.com>
+Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/tty/serial/8250/Kconfig | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/tty/serial/8250/Kconfig
++++ b/drivers/tty/serial/8250/Kconfig
+@@ -372,7 +372,7 @@ config SERIAL_8250_MID
+ tristate "Support for serial ports on Intel MID platforms"
+ depends on SERIAL_8250 && PCI
+ select HSU_DMA if SERIAL_8250_DMA
+- select HSU_DMA_PCI if X86_INTEL_MID
++ select HSU_DMA_PCI if (HSU_DMA && X86_INTEL_MID)
+ select RATIONAL
+ help
+ Selecting this option will enable handling of the extra features
x86-mm-kmmio-fix-mmiotrace-for-page-unaligned-addresses.patch
xen-xen_acpi_processor-is-dom0-only.patch
hippi-fix-a-fix-a-possible-sleep-in-atomic-bug-in-rr_close.patch
+virtio_balloon-prevent-uninitialized-variable-use.patch
+isdn-icn-remove-a-warning.patch
+vmxnet3-prevent-building-with-64k-pages.patch
+gpio-intel-mid-fix-build-warning-when-config_pm.patch
+platform-x86-intel_mid_thermal-fix-suspend-handlers-unused-warning.patch
+video-fbdev-via-remove-possibly-unused-variables.patch
+scsi-advansys-fix-build-warning-for-pci-n.patch
+x86-ras-inject-make-it-depend-on-x86_local_apic-y.patch
+arm64-define-bug-instruction-without-config_bug.patch
+x86-fpu-math-emu-fix-possible-uninitialized-variable-use.patch
+tools-build-add-tools-tree-support-for-make-s.patch
+x86-build-silence-the-build-with-make-s.patch
+thermal-fix-intel_soc_dts_iosf_core-dependencies.patch
+x86-add-multiuser-dependency-for-kvm.patch
+x86-platform-add-pci-dependency-for-punit_atom_debug.patch
+scsi-advansys-fix-uninitialized-data-access.patch
+arm64-kconfig-select-compat_binfmt_elf-only-when-binfmt_elf-is-set.patch
+alsa-hda-ca0132-fix-possible-null-pointer-use.patch
+reiserfs-avoid-a-wmaybe-uninitialized-warning.patch
+ssb-mark-ssb_bus_register-as-__maybe_unused.patch
+thermal-spear-use-__maybe_unused-for-pm-functions.patch
+x86-boot-avoid-warning-for-zero-filling-.bss.patch
+scsi-sim710-fix-build-warning.patch
+drivers-net-fix-eisa_driver-probe-section-mismatch.patch
+dpt_i2o-fix-build-warning.patch
+profile-hide-unused-functions-when-config_proc_fs.patch
+md-avoid-warning-for-32-bit-sector_t.patch
+mtd-ichxrom-maybe-uninitialized-with-gcc-4.9.patch
+mtd-maps-add-__init-attribute.patch
+mptfusion-hide-unused-seq_mpt_print_ioc_summary-function.patch
+scsi-fdomain-drop-fdomain_pci_tbl-when-built-in.patch
+video-fbdev-sis-remove-unused-variable.patch
+staging-ste_rmi4-avoid-unused-function-warnings.patch
+fbdev-sis-enforce-selection-of-at-least-one-backend.patch
+video-use-bool-instead-int-pointer-for-get_opt_bool-argument.patch
+scsi-mvumi-use-__maybe_unused-to-hide-pm-functions.patch
+scsi-initio-remove-duplicate-module-device-table.patch
+pwc-hide-unused-label.patch
+usb-musb-ux500-remove-duplicate-check-for-dma_is_compatible.patch
+tty-hvc_xen-hide-xen_console_remove-when-unused.patch
+target-user-fix-cast-from-pointer-to-phys_addr_t.patch
+driver-core-use-dev-argument-in-dev_dbg_ratelimited-stub.patch
+fbdev-auo_k190x-avoid-unused-function-warnings.patch
+amd-xgbe-fix-unused-suspend-handlers-build-warning.patch
+mtd-sh_flctl-pass-fifo-as-physical-address.patch
+mtd-cfi-enforce-valid-geometry-configuration.patch
+fbdev-s6e8ax0-avoid-unused-function-warnings.patch
+modsign-hide-openssl-output-in-silent-builds.patch
+drivers-hv-vmbus-fix-build-warning.patch
+fbdev-sm712fb-avoid-unused-function-warnings.patch
+hwrng-exynos-use-__maybe_unused-to-hide-pm-functions.patch
+usb-cdc_subset-only-build-when-one-driver-is-enabled.patch
+rtlwifi-fix-gcc-6-indentation-warning.patch
+staging-wilc1000-fix-kbuild-test-robot-error.patch
+x86-platform-olpc-fix-resume-handler-build-warning.patch
+netfilter-ipvs-avoid-unused-variable-warnings.patch
+ipv4-ipconfig-avoid-unused-ic_proto_used-symbol.patch
+tc1100-wmi-fix-build-warning-when-config_pm-not-enabled.patch
+tlan-avoid-unused-label-with-pci-n.patch
+drm-vmwgfx-use-_32_bits-macros.patch
+tty-cyclades-cyz_interrupt-is-only-used-for-pci.patch
+genirq-msi-add-stubs-for-get_cached_msi_msg-pci_write_msi_msg.patch
+asoc-mediatek-add-i2c-dependency.patch
+iio-adc-axp288-remove-redundant-duplicate-const-on-axp288_adc_channels.patch
+infiniband-cxgb4-use-pr-format-string-for-printing-resources.patch
+b2c2-flexcop-avoid-unused-function-warnings.patch
+i2c-remove-__init-from-i2c_register_board_info.patch
+staging-unisys-visorinput-depends-on-input.patch
+tc358743-fix-register-i2c_rd-wr-functions.patch
+drm-nouveau-hide-gcc-4.9-wmaybe-uninitialized.patch
+input-tca8418_keypad-hide-gcc-4.9-wmaybe-uninitialized-warning.patch
+kvm-add-x86_local_apic-dependency.patch
+go7007-add-media_camera_support-dependency.patch
+em28xx-only-use-mt9v011-if-camera-support-is-enabled.patch
+isdn-eicon-reduce-stack-size-of-sig_ind-function.patch
+asoc-rockchip-use-__maybe_unused-to-hide-st_irq_syscfg_resume.patch
+serial-8250_mid-fix-broken-dma-dependency.patch
+drm-gma500-sanity-check-pipe-index.patch
+hdpvr-hide-unused-variable.patch
+v4l-remove-media_tuner-dependency-for-video_tuner.patch
+cw1200-fix-bogus-maybe-uninitialized-warning.patch
+wireless-cw1200-use-__maybe_unused-to-hide-pm-functions_.patch
+perf-x86-shut-up-false-positive-wmaybe-uninitialized-warning.patch
+dmaengine-zx-fix-build-warning.patch
+net-hp100-remove-unnecessary-ifdefs.patch
+gpio-xgene-mark-pm-functions-as-__maybe_unused.patch
+ncpfs-fix-unused-variable-warning.patch
+revert-power-bq27xxx_battery-remove-unneeded-dependency-in-kconfig.patch
+power-bq27xxx_battery-mark-some-symbols-__maybe_unused.patch
+isdn-sc-work-around-type-mismatch-warning.patch
+binfmt_elf-compat-avoid-unused-function-warning.patch
+idle-i7300-add-pci-dependency.patch
+usb-phy-msm-add-regulator-dependency.patch
+ncr5380-shut-up-gcc-indentation-warning.patch
+arm-tegra-select-usb_ulpi-from-ehci-rather-than-platform.patch
+asoc-intel-kconfig-fix-build-when-acpi-is-not-enabled.patch
+netlink-fix-nla_put_-u8-u16-u32-for-kasan.patch
+dell-wmi-dell-laptop-depends-dmi.patch
+genksyms-fix-segfault-with-invalid-declarations.patch
+x86-microcode-amd-change-load_microcode_amd-s-param-to-bool-to-fix-preemptibility-bug.patch
+drm-gma500-remove-helper-function.patch
+kasan-rework-kconfig-settings.patch
+kvm-async_pf-fix-df-due-to-inject-page-not-present-and-page-ready-exceptions-simultaneously.patch
+x86-retpoline-remove-the-esp-rsp-thunk.patch
+kvm-x86-make-indirect-calls-in-emulator-speculation-safe.patch
+kvm-vmx-make-indirect-call-speculation-safe.patch
+module-retpoline-warn-about-missing-retpoline-in-module.patch
+x86-nospec-fix-header-guards-names.patch
+x86-bugs-drop-one-mitigation-from-dmesg.patch
+x86-cpu-bugs-make-retpoline-module-warning-conditional.patch
+x86-spectre-check-config_retpoline-in-command-line-parser.patch
+documentation-document-array_index_nospec.patch
+array_index_nospec-sanitize-speculative-array-de-references.patch
+x86-implement-array_index_mask_nospec.patch
+x86-introduce-barrier_nospec.patch
+x86-get_user-use-pointer-masking-to-limit-speculation.patch
+x86-syscall-sanitize-syscall-table-de-references-under-speculation.patch
+vfs-fdtable-prevent-bounds-check-bypass-via-speculative-execution.patch
+nl80211-sanitize-array-index-in-parse_txq_params.patch
+x86-spectre-report-get_user-mitigation-for-spectre_v1.patch
+x86-spectre-fix-spelling-mistake-vunerable-vulnerable.patch
+x86-paravirt-remove-noreplace-paravirt-cmdline-option.patch
+x86-kvm-update-spectre-v1-mitigation.patch
+x86-retpoline-avoid-retpolines-for-built-in-__init-functions.patch
+x86-spectre-simplify-spectre_v2-command-line-parsing.patch
+x86-speculation-fix-typo-ibrs_att-which-should-be-ibrs_all.patch
+kvm-nvmx-kmap-can-t-fail.patch
+kvm-nvmx-vmx_complete_nested_posted_interrupt-can-t-fail.patch
+kvm-nvmx-fix-kernel-panics-induced-by-illegal-invept-invvpid-types.patch
+kvm-vmx-clean-up-declaration-of-vpid-ept-invalidation-types.patch
+kvm-nvmx-invvpid-handling-improvements.patch
--- /dev/null
+From b7e2d195cc523bd92ed7a64aac089421dbab2a2d Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Mon, 18 Jan 2016 20:39:56 +0100
+Subject: ssb: mark ssb_bus_register as __maybe_unused
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit b7e2d195cc523bd92ed7a64aac089421dbab2a2d upstream.
+
+The SoC variant of the ssb code is now optional like the other
+ones, which means we can build the framwork without any
+front-end, but that results in a warning:
+
+drivers/ssb/main.c:616:12: warning: 'ssb_bus_register' defined but not used [-Wunused-function]
+
+This annotates the ssb_bus_register function as __maybe_unused to
+shut up the warning. A configuration like this will not work on
+any hardware of course, but we still want this to silently build
+without warnings if the configuration is allowed in the first
+place.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Fixes: 845da6e58e19 ("ssb: add Kconfig entry for compiling SoC related code")
+Acked-by: Michael Buesch <m@bues.ch>
+Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/ssb/main.c | 7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
+--- a/drivers/ssb/main.c
++++ b/drivers/ssb/main.c
+@@ -613,9 +613,10 @@ out:
+ return err;
+ }
+
+-static int ssb_bus_register(struct ssb_bus *bus,
+- ssb_invariants_func_t get_invariants,
+- unsigned long baseaddr)
++static int __maybe_unused
++ssb_bus_register(struct ssb_bus *bus,
++ ssb_invariants_func_t get_invariants,
++ unsigned long baseaddr)
+ {
+ int err;
+
--- /dev/null
+From 9045a4a7e686a6316129d6d0b21b4fe2520968e4 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Fri, 20 Nov 2015 22:59:14 +0100
+Subject: staging: ste_rmi4: avoid unused function warnings
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit 9045a4a7e686a6316129d6d0b21b4fe2520968e4 upstream.
+
+The rmi4 touchscreen driver encloses the power-management
+functions in #ifdef CONFIG_PM, but the smtcfb_pci_suspend/resume
+functions are only really used when CONFIG_PM_SLEEP is also
+set, as a frequent gcc warning shows:
+
+ste_rmi4/synaptics_i2c_rmi4.c:1050:12: warning: 'synaptics_rmi4_suspend' defined but not used
+ste_rmi4/synaptics_i2c_rmi4.c:1084:12: warning: 'synaptics_rmi4_resume' defined but not used
+
+This changes the driver to remove the #ifdef and instead mark
+the functions as __maybe_unused, which is a nicer anyway, as it
+provides build testing for all the code in all configurations
+and is harder to get wrong.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Acked-by: Linus Walleij <linus.walleij@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c | 7 ++-----
+ 1 file changed, 2 insertions(+), 5 deletions(-)
+
+--- a/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c
++++ b/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c
+@@ -1039,7 +1039,6 @@ static int synaptics_rmi4_remove(struct
+ return 0;
+ }
+
+-#ifdef CONFIG_PM
+ /**
+ * synaptics_rmi4_suspend() - suspend the touch screen controller
+ * @dev: pointer to device structure
+@@ -1047,7 +1046,7 @@ static int synaptics_rmi4_remove(struct
+ * This function is used to suspend the
+ * touch panel controller and returns integer
+ */
+-static int synaptics_rmi4_suspend(struct device *dev)
++static int __maybe_unused synaptics_rmi4_suspend(struct device *dev)
+ {
+ /* Touch sleep mode */
+ int retval;
+@@ -1081,7 +1080,7 @@ static int synaptics_rmi4_suspend(struct
+ * This function is used to resume the touch panel
+ * controller and returns integer.
+ */
+-static int synaptics_rmi4_resume(struct device *dev)
++static int __maybe_unused synaptics_rmi4_resume(struct device *dev)
+ {
+ int retval;
+ unsigned char intr_status;
+@@ -1112,8 +1111,6 @@ static int synaptics_rmi4_resume(struct
+ return 0;
+ }
+
+-#endif
+-
+ static SIMPLE_DEV_PM_OPS(synaptics_rmi4_dev_pm_ops, synaptics_rmi4_suspend,
+ synaptics_rmi4_resume);
+
--- /dev/null
+From 82ddecfe8de54331bafe2d0ff526739fd0980190 Mon Sep 17 00:00:00 2001
+From: Randy Dunlap <rdunlap@infradead.org>
+Date: Fri, 26 Feb 2016 09:09:59 -0800
+Subject: staging: unisys: visorinput depends on INPUT
+
+From: Randy Dunlap <rdunlap@infradead.org>
+
+commit 82ddecfe8de54331bafe2d0ff526739fd0980190 upstream.
+
+Fix build errors by limiting UNISYS_VISORINPUT to the INPUT kconfig
+setting.
+
+drivers/built-in.o: In function `visorinput_remove':
+visorinput.c:(.text+0x20802e): undefined reference to `input_unregister_device'
+drivers/built-in.o: In function `visorinput_probe':
+visorinput.c:(.text+0x208177): undefined reference to `input_allocate_device'
+visorinput.c:(.text+0x208241): undefined reference to `input_register_device'
+visorinput.c:(.text+0x20824d): undefined reference to `input_free_device'
+visorinput.c:(.text+0x208286): undefined reference to `input_allocate_device'
+visorinput.c:(.text+0x208302): undefined reference to `input_set_abs_params'
+visorinput.c:(.text+0x20831a): undefined reference to `input_set_abs_params'
+visorinput.c:(.text+0x20833f): undefined reference to `input_register_device'
+visorinput.c:(.text+0x20834b): undefined reference to `input_free_device'
+visorinput.c:(.text+0x20835f): undefined reference to `input_set_capability'
+drivers/built-in.o: In function `visorinput_channel_interrupt':
+visorinput.c:(.text+0x20851e): undefined reference to `input_event'
+visorinput.c:(.text+0x20862c): undefined reference to `input_event'
+drivers/built-in.o: In function `input_report_key':
+visorinput.c:(.text+0x207fd1): undefined reference to `input_event'
+drivers/built-in.o: In function `input_sync':
+visorinput.c:(.text+0x207fdc): undefined reference to `input_event'
+
+Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/staging/unisys/visorinput/Kconfig | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/staging/unisys/visorinput/Kconfig
++++ b/drivers/staging/unisys/visorinput/Kconfig
+@@ -4,7 +4,7 @@
+
+ config UNISYS_VISORINPUT
+ tristate "Unisys visorinput driver"
+- depends on UNISYSSPAR && UNISYS_VISORBUS && FB
++ depends on UNISYSSPAR && UNISYS_VISORBUS && FB && INPUT
+ ---help---
+ If you say Y here, you will enable the Unisys visorinput driver.
+
--- /dev/null
+From b22fa80cdbf4ff1056ecddb4efdcc0ede5f5f422 Mon Sep 17 00:00:00 2001
+From: Glen Lee <glen.lee@atmel.com>
+Date: Thu, 5 Nov 2015 16:12:08 +0900
+Subject: staging: wilc1000: fix kbuild test robot error
+
+From: Glen Lee <glen.lee@atmel.com>
+
+commit b22fa80cdbf4ff1056ecddb4efdcc0ede5f5f422 upstream.
+
+This patch fixes build warning and error reported by kbuild test robot.
+It is fixed by including netdevice.h.
+
+>> drivers/staging/wilc1000/wilc_wlan_if.h:940:27: warning: 'struct net_device'
+ declared inside parameter list
+ int wilc_wlan_init(struct net_device *dev, wilc_wlan_inp_t *inp);
+>> drivers/staging/wilc1000/wilc_wlan_if.h:940:27: warning: its scope is only
+ this definition or declaration, which is probably not what you want
+>> drivers/staging/wilc1000/wilc_wlan.c:1954:5: error: conflicting types for
+ 'wilc_wlan_init'
+ int wilc_wlan_init(struct net_device *dev, wilc_wlan_inp_t *inp)
+
+Fixes: 30135ce ("staging: wilc1000: wilc_wlan_init: add argument struct net_device")
+Reported-by: kbuild test robot <fengguang.wu@intel.com>
+Signed-off-by: Glen Lee <glen.lee@atmel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/staging/wilc1000/wilc_wlan_if.h | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/staging/wilc1000/wilc_wlan_if.h
++++ b/drivers/staging/wilc1000/wilc_wlan_if.h
+@@ -12,6 +12,7 @@
+
+ #include <linux/semaphore.h>
+ #include "linux_wlan_common.h"
++#include <linux/netdevice.h>
+
+ /********************************************
+ *
--- /dev/null
+From 0633e123465b61a12a262b742bebf2a9945f7964 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Mon, 1 Feb 2016 17:29:45 +0100
+Subject: target/user: Fix cast from pointer to phys_addr_t
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit 0633e123465b61a12a262b742bebf2a9945f7964 upstream.
+
+The uio_mem structure has a member that is a phys_addr_t, but can
+be a number of other types too. The target core driver attempts
+to assign a pointer from vmalloc() to it, by casting it to
+phys_addr_t, but that causes a warning when phys_addr_t is longer
+than a pointer:
+
+drivers/target/target_core_user.c: In function 'tcmu_configure_device':
+drivers/target/target_core_user.c:906:22: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
+
+This adds another cast to uintptr_t to shut up the warning.
+A nicer fix might be to have additional fields in uio_mem
+for the different purposes, so we can assign a pointer directly.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/target/target_core_user.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/target/target_core_user.c
++++ b/drivers/target/target_core_user.c
+@@ -900,7 +900,7 @@ static int tcmu_configure_device(struct
+ info->version = __stringify(TCMU_MAILBOX_VERSION);
+
+ info->mem[0].name = "tcm-user command & data buffer";
+- info->mem[0].addr = (phys_addr_t) udev->mb_addr;
++ info->mem[0].addr = (phys_addr_t)(uintptr_t)udev->mb_addr;
+ info->mem[0].size = TCMU_RING_SIZE;
+ info->mem[0].memtype = UIO_MEM_VIRTUAL;
+
--- /dev/null
+From 75d7e7d7a8f4966cb8b1da54a1c74fb2a97ae8fc Mon Sep 17 00:00:00 2001
+From: Colin Ian King <colin.king@canonical.com>
+Date: Wed, 6 Jan 2016 18:02:59 +0000
+Subject: tc1100-wmi: fix build warning when CONFIG_PM not enabled
+
+From: Colin Ian King <colin.king@canonical.com>
+
+commit 75d7e7d7a8f4966cb8b1da54a1c74fb2a97ae8fc upstream.
+
+Conditionally declare suspend_data on CONFIG_PM to avoid
+the following warning when CONFIG_OM is not enabled:
+
+drivers/platform/x86/tc1100-wmi.c:55:27: warning:
+ 'suspend_data' defined but not used [-Wunused-variable]
+
+Signed-off-by: Colin Ian King <colin.king@canonical.com>
+Signed-off-by: Darren Hart <dvhart@linux.intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/platform/x86/tc1100-wmi.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/drivers/platform/x86/tc1100-wmi.c
++++ b/drivers/platform/x86/tc1100-wmi.c
+@@ -52,7 +52,9 @@ struct tc1100_data {
+ u32 jogdial;
+ };
+
++#ifdef CONFIG_PM
+ static struct tc1100_data suspend_data;
++#endif
+
+ /* --------------------------------------------------------------------------
+ Device Management
--- /dev/null
+From 3538aa6ecfb2dd727a40f9ebbbf25a0c2afe6226 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Wed, 8 Feb 2017 19:14:13 -0200
+Subject: [media] tc358743: fix register i2c_rd/wr functions
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit 3538aa6ecfb2dd727a40f9ebbbf25a0c2afe6226 upstream.
+
+While testing with CONFIG_UBSAN, I got this warning:
+
+drivers/media/i2c/tc358743.c: In function 'tc358743_probe':
+drivers/media/i2c/tc358743.c:1930:1: error: the frame size of 2480 bytes is larger than 2048 bytes [-Werror=frame-larger-than=]
+
+The problem is that the i2c_rd8/wr8/rd16/... functions in this driver pass
+a pointer to a local variable into a common function, and each call to one
+of them adds another variable plus redzone to the stack.
+
+I also noticed that the way this is done is broken on big-endian machines,
+as we copy the registers in CPU byte order.
+
+To address both those problems, I'm adding two helper functions for reading
+a register of up to 32 bits with correct endianess and change all other
+functions to use that instead. Just to be sure we don't get the problem
+back with changed optimizations in gcc, I'm also marking the new functions
+as 'noinline', although my tests with gcc-7 don't require that.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
+Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/media/i2c/tc358743.c | 46 +++++++++++++++++++++++--------------------
+ 1 file changed, 25 insertions(+), 21 deletions(-)
+
+--- a/drivers/media/i2c/tc358743.c
++++ b/drivers/media/i2c/tc358743.c
+@@ -197,57 +197,61 @@ static void i2c_wr(struct v4l2_subdev *s
+ }
+ }
+
+-static u8 i2c_rd8(struct v4l2_subdev *sd, u16 reg)
++static noinline u32 i2c_rdreg(struct v4l2_subdev *sd, u16 reg, u32 n)
+ {
+- u8 val;
++ __le32 val = 0;
+
+- i2c_rd(sd, reg, &val, 1);
++ i2c_rd(sd, reg, (u8 __force *)&val, n);
+
+- return val;
++ return le32_to_cpu(val);
++}
++
++static noinline void i2c_wrreg(struct v4l2_subdev *sd, u16 reg, u32 val, u32 n)
++{
++ __le32 raw = cpu_to_le32(val);
++
++ i2c_wr(sd, reg, (u8 __force *)&raw, n);
++}
++
++static u8 i2c_rd8(struct v4l2_subdev *sd, u16 reg)
++{
++ return i2c_rdreg(sd, reg, 1);
+ }
+
+ static void i2c_wr8(struct v4l2_subdev *sd, u16 reg, u8 val)
+ {
+- i2c_wr(sd, reg, &val, 1);
++ i2c_wrreg(sd, reg, val, 1);
+ }
+
+ static void i2c_wr8_and_or(struct v4l2_subdev *sd, u16 reg,
+ u8 mask, u8 val)
+ {
+- i2c_wr8(sd, reg, (i2c_rd8(sd, reg) & mask) | val);
++ i2c_wrreg(sd, reg, (i2c_rdreg(sd, reg, 2) & mask) | val, 2);
+ }
+
+ static u16 i2c_rd16(struct v4l2_subdev *sd, u16 reg)
+ {
+- u16 val;
+-
+- i2c_rd(sd, reg, (u8 *)&val, 2);
+-
+- return val;
++ return i2c_rdreg(sd, reg, 2);
+ }
+
+ static void i2c_wr16(struct v4l2_subdev *sd, u16 reg, u16 val)
+ {
+- i2c_wr(sd, reg, (u8 *)&val, 2);
++ i2c_wrreg(sd, reg, val, 2);
+ }
+
+ static void i2c_wr16_and_or(struct v4l2_subdev *sd, u16 reg, u16 mask, u16 val)
+ {
+- i2c_wr16(sd, reg, (i2c_rd16(sd, reg) & mask) | val);
++ i2c_wrreg(sd, reg, (i2c_rdreg(sd, reg, 2) & mask) | val, 2);
+ }
+
+ static u32 i2c_rd32(struct v4l2_subdev *sd, u16 reg)
+ {
+- u32 val;
+-
+- i2c_rd(sd, reg, (u8 *)&val, 4);
+-
+- return val;
++ return i2c_rdreg(sd, reg, 4);
+ }
+
+ static void i2c_wr32(struct v4l2_subdev *sd, u16 reg, u32 val)
+ {
+- i2c_wr(sd, reg, (u8 *)&val, 4);
++ i2c_wrreg(sd, reg, val, 4);
+ }
+
+ /* --------------- STATUS --------------- */
+@@ -1240,7 +1244,7 @@ static int tc358743_g_register(struct v4
+
+ reg->size = tc358743_get_reg_size(reg->reg);
+
+- i2c_rd(sd, reg->reg, (u8 *)®->val, reg->size);
++ reg->val = i2c_rdreg(sd, reg->reg, reg->size);
+
+ return 0;
+ }
+@@ -1266,7 +1270,7 @@ static int tc358743_s_register(struct v4
+ reg->reg == BCAPS)
+ return 0;
+
+- i2c_wr(sd, (u16)reg->reg, (u8 *)®->val,
++ i2c_wrreg(sd, (u16)reg->reg, reg->val,
+ tc358743_get_reg_size(reg->reg));
+
+ return 0;
--- /dev/null
+From 68fd77cf8a4b045594231f07e5fc92e1a34c0a9e Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Fri, 21 Jul 2017 18:16:28 +0200
+Subject: thermal: fix INTEL_SOC_DTS_IOSF_CORE dependencies
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit 68fd77cf8a4b045594231f07e5fc92e1a34c0a9e upstream.
+
+We get a Kconfig warning when selecting this without also enabling
+CONFIG_PCI:
+
+warning: (X86_INTEL_LPSS && INTEL_SOC_DTS_IOSF_CORE
+&& SND_SST_IPC_ACPI && MMC_SDHCI_ACPI && PUNIT_ATOM_DEBUG)
+selects IOSF_MBI which has unmet direct dependencies (PCI)
+
+This adds a new depedency.
+
+Fixes: 3a2419f865a6 ("Thermal: Intel SoC: DTS thermal use common APIs")
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Reviewed-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
+Signed-off-by: Zhang Rui <rui.zhang@intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/thermal/Kconfig | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/drivers/thermal/Kconfig
++++ b/drivers/thermal/Kconfig
+@@ -299,7 +299,7 @@ config X86_PKG_TEMP_THERMAL
+
+ config INTEL_SOC_DTS_IOSF_CORE
+ tristate
+- depends on X86
++ depends on X86 && PCI
+ select IOSF_MBI
+ help
+ This is becoming a common feature for Intel SoCs to expose the additional
+@@ -309,7 +309,7 @@ config INTEL_SOC_DTS_IOSF_CORE
+
+ config INTEL_SOC_DTS_THERMAL
+ tristate "Intel SoCs DTS thermal driver"
+- depends on X86
++ depends on X86 && PCI
+ select INTEL_SOC_DTS_IOSF_CORE
+ select THERMAL_WRITABLE_TRIPS
+ help
--- /dev/null
+From d612c64d1f4d6b2464993dfeafd9ec319f774188 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Mon, 25 Jan 2016 17:44:10 +0100
+Subject: thermal: spear: use __maybe_unused for PM functions
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit d612c64d1f4d6b2464993dfeafd9ec319f774188 upstream.
+
+The spear thermal driver hides its suspend/resume function conditionally
+based on CONFIG_PM, but references them based on CONFIG_PM_SLEEP, so
+we get a warning if the former is set but the latter is not:
+
+thermal/spear_thermal.c:58:12: warning: 'spear_thermal_suspend' defined but not used [-Wunused-function]
+thermal/spear_thermal.c:75:12: warning: 'spear_thermal_resume' defined but not used [-Wunused-function]
+
+This removes the #ifdef and instead uses a __maybe_uninitialized
+annotation to avoid the warning and improve compile-time coverage.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/thermal/spear_thermal.c | 6 ++----
+ 1 file changed, 2 insertions(+), 4 deletions(-)
+
+--- a/drivers/thermal/spear_thermal.c
++++ b/drivers/thermal/spear_thermal.c
+@@ -54,8 +54,7 @@ static struct thermal_zone_device_ops op
+ .get_temp = thermal_get_temp,
+ };
+
+-#ifdef CONFIG_PM
+-static int spear_thermal_suspend(struct device *dev)
++static int __maybe_unused spear_thermal_suspend(struct device *dev)
+ {
+ struct platform_device *pdev = to_platform_device(dev);
+ struct thermal_zone_device *spear_thermal = platform_get_drvdata(pdev);
+@@ -72,7 +71,7 @@ static int spear_thermal_suspend(struct
+ return 0;
+ }
+
+-static int spear_thermal_resume(struct device *dev)
++static int __maybe_unused spear_thermal_resume(struct device *dev)
+ {
+ struct platform_device *pdev = to_platform_device(dev);
+ struct thermal_zone_device *spear_thermal = platform_get_drvdata(pdev);
+@@ -94,7 +93,6 @@ static int spear_thermal_resume(struct d
+
+ return 0;
+ }
+-#endif
+
+ static SIMPLE_DEV_PM_OPS(spear_thermal_pm_ops, spear_thermal_suspend,
+ spear_thermal_resume);
--- /dev/null
+From 1e09c106a44c2b2685a77a1ef27951381c9fcd23 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Mon, 10 Oct 2016 14:41:10 +0200
+Subject: tlan: avoid unused label with PCI=n
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit 1e09c106a44c2b2685a77a1ef27951381c9fcd23 upstream.
+
+While build testing with randconfig on x86, I ran into this warning
+that appears to have been around forever
+
+drivers/net/ethernet/ti/tlan.c: In function ‘tlan_probe1’:
+drivers/net/ethernet/ti/tlan.c:614:1: error: label ‘err_out’ defined but not used [-Werror=unused-label]
+
+This can be trivially avoided by just moving the label into the
+existing #ifdef.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/net/ethernet/ti/tlan.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/net/ethernet/ti/tlan.c
++++ b/drivers/net/ethernet/ti/tlan.c
+@@ -610,8 +610,8 @@ err_out_regions:
+ #ifdef CONFIG_PCI
+ if (pdev)
+ pci_release_regions(pdev);
+-#endif
+ err_out:
++#endif
+ if (pdev)
+ pci_disable_device(pdev);
+ return rc;
--- /dev/null
+From e572d0887137acfc53f18175522964ec19d88175 Mon Sep 17 00:00:00 2001
+From: Josh Poimboeuf <jpoimboe@redhat.com>
+Date: Wed, 18 Jan 2017 22:16:55 -0600
+Subject: tools build: Add tools tree support for 'make -s'
+
+From: Josh Poimboeuf <jpoimboe@redhat.com>
+
+commit e572d0887137acfc53f18175522964ec19d88175 upstream.
+
+When doing a kernel build with 'make -s', everything is silenced except
+the objtool build. That's because the tools tree support for silent
+builds is some combination of missing and broken.
+
+Three changes are needed to fix it:
+
+- Makefile: propagate '-s' to the sub-make's MAKEFLAGS variable so the
+ tools Makefiles can see it.
+
+- tools/scripts/Makefile.include: fix the tools Makefiles' ability to
+ recognize '-s'. The MAKE_VERSION and MAKEFLAGS checks are copied from
+ the top-level Makefile. This silences the "DESCEND objtool" message.
+
+- tools/build/Makefile.build: add support to the tools Build files for
+ recognizing '-s'. Again the MAKE_VERSION and MAKEFLAGS checks are
+ copied from the top-level Makefile. This silences all the object
+ compile/link messages.
+
+Reported-and-Tested-by: Peter Zijlstra <peterz@infradead.org>
+Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
+Cc: Jiri Olsa <jolsa@kernel.org>
+Cc: Michal Marek <mmarek@suse.com>
+Link: http://lkml.kernel.org/r/e8967562ef640c3ae9a76da4ae0f4e47df737c34.1484799200.git.jpoimboe@redhat.com
+Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ Makefile | 6 ++++--
+ tools/build/Makefile.build | 10 ++++++++++
+ tools/scripts/Makefile.include | 12 +++++++++++-
+ 3 files changed, 25 insertions(+), 3 deletions(-)
+
+--- a/Makefile
++++ b/Makefile
+@@ -87,10 +87,12 @@ endif
+ ifneq ($(filter 4.%,$(MAKE_VERSION)),) # make-4
+ ifneq ($(filter %s ,$(firstword x$(MAKEFLAGS))),)
+ quiet=silent_
++ tools_silent=s
+ endif
+ else # make-3.8x
+ ifneq ($(filter s% -s%,$(MAKEFLAGS)),)
+ quiet=silent_
++ tools_silent=-s
+ endif
+ endif
+
+@@ -1523,11 +1525,11 @@ image_name:
+ # Clear a bunch of variables before executing the submake
+ tools/: FORCE
+ $(Q)mkdir -p $(objtree)/tools
+- $(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(filter --j% -j,$(MAKEFLAGS))" O=$(shell cd $(objtree) && /bin/pwd) subdir=tools -C $(src)/tools/
++ $(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(tools_silent) $(filter --j% -j,$(MAKEFLAGS))" O=$(shell cd $(objtree) && /bin/pwd) subdir=tools -C $(src)/tools/
+
+ tools/%: FORCE
+ $(Q)mkdir -p $(objtree)/tools
+- $(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(filter --j% -j,$(MAKEFLAGS))" O=$(shell cd $(objtree) && /bin/pwd) subdir=tools -C $(src)/tools/ $*
++ $(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(tools_silent) $(filter --j% -j,$(MAKEFLAGS))" O=$(shell cd $(objtree) && /bin/pwd) subdir=tools -C $(src)/tools/ $*
+
+ # Single targets
+ # ---------------------------------------------------------------------------
+--- a/tools/build/Makefile.build
++++ b/tools/build/Makefile.build
+@@ -19,6 +19,16 @@ else
+ Q=@
+ endif
+
++ifneq ($(filter 4.%,$(MAKE_VERSION)),) # make-4
++ifneq ($(filter %s ,$(firstword x$(MAKEFLAGS))),)
++ quiet=silent_
++endif
++else # make-3.8x
++ifneq ($(filter s% -s%,$(MAKEFLAGS)),)
++ quiet=silent_
++endif
++endif
++
+ build-dir := $(srctree)/tools/build
+
+ # Define $(fixdep) for dep-cmd function
+--- a/tools/scripts/Makefile.include
++++ b/tools/scripts/Makefile.include
+@@ -46,6 +46,16 @@ else
+ NO_SUBDIR = :
+ endif
+
++ifneq ($(filter 4.%,$(MAKE_VERSION)),) # make-4
++ifneq ($(filter %s ,$(firstword x$(MAKEFLAGS))),)
++ silent=1
++endif
++else # make-3.8x
++ifneq ($(filter s% -s%,$(MAKEFLAGS)),)
++ silent=1
++endif
++endif
++
+ #
+ # Define a callable command for descending to a new directory
+ #
+@@ -58,7 +68,7 @@ descend = \
+ QUIET_SUBDIR0 = +$(MAKE) $(COMMAND_O) -C # space to separate -C and subdir
+ QUIET_SUBDIR1 =
+
+-ifneq ($(findstring $(MAKEFLAGS),s),s)
++ifneq ($(silent),1)
+ ifneq ($(V),1)
+ QUIET_CC = @echo ' CC '$@;
+ QUIET_CC_FPIC = @echo ' CC FPIC '$@;
--- /dev/null
+From 05ead49691d245f67bdd1b30cab5d9af522ac884 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Mon, 25 Jan 2016 22:54:57 +0100
+Subject: tty: cyclades: cyz_interrupt is only used for PCI
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit 05ead49691d245f67bdd1b30cab5d9af522ac884 upstream.
+
+When CONFIG_PCI is not set, enabling CONFIG_CYZ_INTR has no
+practical effect other than generating a warning about an
+unused function:
+
+drivers/tty/cyclades.c:1184:20: warning: 'cyz_interrupt' defined but not used [-Wunused-function]
+ static irqreturn_t cyz_interrupt(int irq, void *dev_id)
+
+This adds a dependency to avoid that warning.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/tty/Kconfig | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/tty/Kconfig
++++ b/drivers/tty/Kconfig
+@@ -226,7 +226,7 @@ config CYCLADES
+
+ config CYZ_INTR
+ bool "Cyclades-Z interrupt mode operation"
+- depends on CYCLADES
++ depends on CYCLADES && PCI
+ help
+ The Cyclades-Z family of multiport cards allows 2 (two) driver op
+ modes: polling and interrupt. In polling mode, the driver will check
--- /dev/null
+From e36ae3439936e13c33f5841c7c2c1a9875acbb6d Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Mon, 25 Jan 2016 22:54:58 +0100
+Subject: tty: hvc_xen: hide xen_console_remove when unused
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit e36ae3439936e13c33f5841c7c2c1a9875acbb6d upstream.
+
+xencons_disconnect_backend() is only called from xen_console_remove(),
+which is conditionally compiled, so we get a harmless warning when
+CONFIG_HVC_XEN_FRONTEND is unset:
+
+hvc/hvc_xen.c:350:12: error: 'xen_console_remove' defined but not used [-Werror=unused-function]
+
+This moves the function down into the same #ifdef section to silence
+the warning.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/tty/hvc/hvc_xen.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/tty/hvc/hvc_xen.c
++++ b/drivers/tty/hvc/hvc_xen.c
+@@ -323,6 +323,7 @@ void xen_console_resume(void)
+ }
+ }
+
++#ifdef CONFIG_HVC_XEN_FRONTEND
+ static void xencons_disconnect_backend(struct xencons_info *info)
+ {
+ if (info->irq > 0)
+@@ -363,7 +364,6 @@ static int xen_console_remove(struct xen
+ return 0;
+ }
+
+-#ifdef CONFIG_HVC_XEN_FRONTEND
+ static int xencons_remove(struct xenbus_device *dev)
+ {
+ return xen_console_remove(dev_get_drvdata(&dev->dev));
--- /dev/null
+From f3bb23764fac042d189129d485d3a9246cb777da Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Wed, 17 Feb 2016 23:25:11 +0100
+Subject: USB: cdc_subset: only build when one driver is enabled
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit f3bb23764fac042d189129d485d3a9246cb777da upstream.
+
+This avoids a harmless randconfig warning I get when USB_NET_CDC_SUBSET
+is enabled, but all of the more specific drivers are not:
+
+drivers/net/usb/cdc_subset.c:241:2: #warning You need to configure some hardware for this driver
+
+The current behavior is clearly intentional, giving a warning when
+a user picks a configuration that won't do anything good. The only
+reason for even addressing this is that I'm getting close to
+eliminating all 'randconfig' warnings on ARM, and this came up
+a couple of times.
+
+My workaround is to not even build the module when none of the
+configurations are enable.
+
+Alternatively we could simply remove the #warning (nothing wrong
+for compile-testing), turn it into a runtime warning, or
+change the Kconfig options into a menu to hide CONFIG_USB_NET_CDC_SUBSET.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/net/usb/Kconfig | 10 ++++++++++
+ drivers/net/usb/Makefile | 2 +-
+ 2 files changed, 11 insertions(+), 1 deletion(-)
+
+--- a/drivers/net/usb/Kconfig
++++ b/drivers/net/usb/Kconfig
+@@ -395,6 +395,10 @@ config USB_NET_RNDIS_HOST
+ The protocol specification is incomplete, and is controlled by
+ (and for) Microsoft; it isn't an "Open" ecosystem or market.
+
++config USB_NET_CDC_SUBSET_ENABLE
++ tristate
++ depends on USB_NET_CDC_SUBSET
++
+ config USB_NET_CDC_SUBSET
+ tristate "Simple USB Network Links (CDC Ethernet subset)"
+ depends on USB_USBNET
+@@ -413,6 +417,7 @@ config USB_NET_CDC_SUBSET
+ config USB_ALI_M5632
+ bool "ALi M5632 based 'USB 2.0 Data Link' cables"
+ depends on USB_NET_CDC_SUBSET
++ select USB_NET_CDC_SUBSET_ENABLE
+ help
+ Choose this option if you're using a host-to-host cable
+ based on this design, which supports USB 2.0 high speed.
+@@ -420,6 +425,7 @@ config USB_ALI_M5632
+ config USB_AN2720
+ bool "AnchorChips 2720 based cables (Xircom PGUNET, ...)"
+ depends on USB_NET_CDC_SUBSET
++ select USB_NET_CDC_SUBSET_ENABLE
+ help
+ Choose this option if you're using a host-to-host cable
+ based on this design. Note that AnchorChips is now a
+@@ -428,6 +434,7 @@ config USB_AN2720
+ config USB_BELKIN
+ bool "eTEK based host-to-host cables (Advance, Belkin, ...)"
+ depends on USB_NET_CDC_SUBSET
++ select USB_NET_CDC_SUBSET_ENABLE
+ default y
+ help
+ Choose this option if you're using a host-to-host cable
+@@ -437,6 +444,7 @@ config USB_BELKIN
+ config USB_ARMLINUX
+ bool "Embedded ARM Linux links (iPaq, ...)"
+ depends on USB_NET_CDC_SUBSET
++ select USB_NET_CDC_SUBSET_ENABLE
+ default y
+ help
+ Choose this option to support the "usb-eth" networking driver
+@@ -454,6 +462,7 @@ config USB_ARMLINUX
+ config USB_EPSON2888
+ bool "Epson 2888 based firmware (DEVELOPMENT)"
+ depends on USB_NET_CDC_SUBSET
++ select USB_NET_CDC_SUBSET_ENABLE
+ help
+ Choose this option to support the usb networking links used
+ by some sample firmware from Epson.
+@@ -461,6 +470,7 @@ config USB_EPSON2888
+ config USB_KC2190
+ bool "KT Technology KC2190 based cables (InstaNet)"
+ depends on USB_NET_CDC_SUBSET
++ select USB_NET_CDC_SUBSET_ENABLE
+ help
+ Choose this option if you're using a host-to-host cable
+ with one of these chips.
+--- a/drivers/net/usb/Makefile
++++ b/drivers/net/usb/Makefile
+@@ -23,7 +23,7 @@ obj-$(CONFIG_USB_NET_GL620A) += gl620a.o
+ obj-$(CONFIG_USB_NET_NET1080) += net1080.o
+ obj-$(CONFIG_USB_NET_PLUSB) += plusb.o
+ obj-$(CONFIG_USB_NET_RNDIS_HOST) += rndis_host.o
+-obj-$(CONFIG_USB_NET_CDC_SUBSET) += cdc_subset.o
++obj-$(CONFIG_USB_NET_CDC_SUBSET_ENABLE) += cdc_subset.o
+ obj-$(CONFIG_USB_NET_ZAURUS) += zaurus.o
+ obj-$(CONFIG_USB_NET_MCS7830) += mcs7830.o
+ obj-$(CONFIG_USB_USBNET) += usbnet.o
--- /dev/null
+From 62a6abdd427b5fc4d8aad5dac874904e96273e6d Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Thu, 28 Jan 2016 17:23:15 +0100
+Subject: usb: musb/ux500: remove duplicate check for dma_is_compatible
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit 62a6abdd427b5fc4d8aad5dac874904e96273e6d upstream.
+
+When dma_addr_t is 64-bit, we get a warning about an invalid cast
+in the call to ux500_dma_is_compatible() from ux500_dma_channel_program():
+
+drivers/usb/musb/ux500_dma.c: In function 'ux500_dma_channel_program':
+drivers/usb/musb/ux500_dma.c:210:51: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
+ if (!ux500_dma_is_compatible(channel, packet_sz, (void *)dma_addr, len))
+
+The problem is that ux500_dma_is_compatible() is called from the
+main musb driver on the virtual address, but here we pass in a
+DMA address, so the types are fundamentally different but it works
+because the function only checks the alignment of the buffer and
+that is the same.
+
+We could work around this by adding another cast, but I have checked
+that the buffer we get passed here is already checked before it
+gets mapped, so the second check seems completely unnecessary
+and removing it must be the cleanest solution.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Felipe Balbi <balbi@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/musb/ux500_dma.c | 3 ---
+ 1 file changed, 3 deletions(-)
+
+--- a/drivers/usb/musb/ux500_dma.c
++++ b/drivers/usb/musb/ux500_dma.c
+@@ -207,9 +207,6 @@ static int ux500_dma_channel_program(str
+ BUG_ON(channel->status == MUSB_DMA_STATUS_UNKNOWN ||
+ channel->status == MUSB_DMA_STATUS_BUSY);
+
+- if (!ux500_dma_is_compatible(channel, packet_sz, (void *)dma_addr, len))
+- return false;
+-
+ channel->status = MUSB_DMA_STATUS_BUSY;
+ channel->actual_len = 0;
+ ret = ux500_configure_channel(channel, packet_sz, mode, dma_addr, len);
--- /dev/null
+From foo@baz Fri Feb 23 17:12:49 CET 2018
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Tue, 20 Feb 2018 12:54:54 +0100
+Subject: usb: phy: msm add regulator dependency
+To: stable@vger.kernel.org
+Cc: Greg KH <gregkh@linuxfoundation.org>, linux-kernel@vger.kernel.org, Arnd Bergmann <arnd@arndb.de>, Felipe Balbi <balbi@ti.com>, linux-usb@vger.kernel.org
+Message-ID: <20180220115527.1806578-8-arnd@arndb.de>
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+On linux-4.4 and linux-4.9 we get a warning about an array that is
+never initialized when CONFIG_REGULATOR is disabled:
+
+drivers/usb/phy/phy-msm-usb.c: In function 'msm_otg_probe':
+drivers/usb/phy/phy-msm-usb.c:1911:14: error: 'regs[0].consumer' may be used uninitialized in this function [-Werror=maybe-uninitialized]
+ motg->vddcx = regs[0].consumer;
+ ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
+drivers/usb/phy/phy-msm-usb.c:1912:14: error: 'regs[1].consumer' may be used uninitialized in this function [-Werror=maybe-uninitialized]
+ motg->v3p3 = regs[1].consumer;
+ ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
+drivers/usb/phy/phy-msm-usb.c:1913:14: error: 'regs[2].consumer' may be used uninitialized in this function [-Werror=maybe-uninitialized]
+ motg->v1p8 = regs[2].consumer;
+
+This adds a Kconfig dependency for it. In newer kernels, the driver no
+longer exists, so this is only needed for stable kernels.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/usb/phy/Kconfig | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/usb/phy/Kconfig
++++ b/drivers/usb/phy/Kconfig
+@@ -140,6 +140,7 @@ config USB_MSM_OTG
+ tristate "Qualcomm on-chip USB OTG controller support"
+ depends on (USB || USB_GADGET) && (ARCH_QCOM || COMPILE_TEST)
+ depends on RESET_CONTROLLER
++ depends on REGULATOR
+ depends on EXTCON
+ select USB_PHY
+ help
--- /dev/null
+From 7c8fe516bd81d991feb73ccd969ec29850af3013 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Tue, 26 Jan 2016 19:46:02 -0200
+Subject: [media] v4l: remove MEDIA_TUNER dependency for VIDEO_TUNER
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit 7c8fe516bd81d991feb73ccd969ec29850af3013 upstream.
+
+em28xx selects VIDEO_TUNER, which has a dependency on MEDIA_TUNER,
+so we get a Kconfig warning if that is disabled:
+
+warning: (VIDEO_PVRUSB2 && VIDEO_USBVISION && VIDEO_GO7007 && VIDEO_AU0828_V4L2 && VIDEO_CX231XX && VIDEO_TM6000 && VIDEO_EM28XX && VIDEO_IVTV && VIDEO_MXB && VIDEO_CX18 && VIDEO_CX23885 && VIDEO_CX88 && VIDEO_BT848 && VIDEO_SAA7134 && VIDEO_SAA7164) selects VIDEO_TUNER which has unmet direct dependencies (MEDIA_SUPPORT && MEDIA_TUNER)
+
+VIDEO_TUNER does not actually depend on MEDIA_TUNER, and the
+dependency does nothing except cause the above warning, so let's
+remove it.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/media/v4l2-core/Kconfig | 1 -
+ 1 file changed, 1 deletion(-)
+
+--- a/drivers/media/v4l2-core/Kconfig
++++ b/drivers/media/v4l2-core/Kconfig
+@@ -37,7 +37,6 @@ config VIDEO_PCI_SKELETON
+ # Used by drivers that need tuner.ko
+ config VIDEO_TUNER
+ tristate
+- depends on MEDIA_TUNER
+
+ # Used by drivers that need v4l2-mem2mem.ko
+ config V4L2_MEM2MEM_DEV
--- /dev/null
+From foo@baz Fri Feb 23 17:23:58 CET 2018
+From: Jack Wang <jinpu.wang@profitbricks.com>
+Date: Fri, 23 Feb 2018 11:42:05 +0100
+Subject: vfs, fdtable: Prevent bounds-check bypass via speculative execution
+To: gregkh@linuxfoundation.org, stable@vger.kernel.org
+Cc: Dan Williams <dan.j.williams@intel.com>, Thomas Gleixner <tglx@linutronix.de>, linux-arch@vger.kernel.org, kernel-hardening@lists.openwall.com, Al Viro <viro@zeniv.linux.org.uk>, torvalds@linux-foundation.org, alan@linux.intel.com, David Woodhouse <dwmw@amazon.co.uk>, Jack Wang <jinpu.wang@profitbricks.com>
+Message-ID: <1519382538-15143-17-git-send-email-jinpu.wangl@profitbricks.com>
+
+From: Dan Williams <dan.j.williams@intel.com>
+
+(cherry picked from commit 56c30ba7b348b90484969054d561f711ba196507)
+
+'fd' is a user controlled value that is used as a data dependency to
+read from the 'fdt->fd' array. In order to avoid potential leaks of
+kernel memory values, block speculative execution of the instruction
+stream that could issue reads based on an invalid 'file *' returned from
+__fcheck_files.
+
+Co-developed-by: Elena Reshetova <elena.reshetova@intel.com>
+Signed-off-by: Dan Williams <dan.j.williams@intel.com>
+Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
+Cc: linux-arch@vger.kernel.org
+Cc: kernel-hardening@lists.openwall.com
+Cc: gregkh@linuxfoundation.org
+Cc: Al Viro <viro@zeniv.linux.org.uk>
+Cc: torvalds@linux-foundation.org
+Cc: alan@linux.intel.com
+Link: https://lkml.kernel.org/r/151727418500.33451.17392199002892248656.stgit@dwillia2-desk3.amr.corp.intel.com
+Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
+[jwang: cherry pick to 4.4]
+Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ include/linux/fdtable.h | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+--- a/include/linux/fdtable.h
++++ b/include/linux/fdtable.h
+@@ -9,6 +9,7 @@
+ #include <linux/compiler.h>
+ #include <linux/spinlock.h>
+ #include <linux/rcupdate.h>
++#include <linux/nospec.h>
+ #include <linux/types.h>
+ #include <linux/init.h>
+ #include <linux/fs.h>
+@@ -81,8 +82,10 @@ static inline struct file *__fcheck_file
+ {
+ struct fdtable *fdt = rcu_dereference_raw(files->fdt);
+
+- if (fd < fdt->max_fds)
++ if (fd < fdt->max_fds) {
++ fd = array_index_nospec(fd, fdt->max_fds);
+ return rcu_dereference_raw(fdt->fd[fd]);
++ }
+ return NULL;
+ }
+
--- /dev/null
+From 32ad61951574d011d363694d6037592e99da9421 Mon Sep 17 00:00:00 2001
+From: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
+Date: Mon, 29 Feb 2016 23:32:29 +0530
+Subject: video: fbdev: sis: remove unused variable
+
+From: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
+
+commit 32ad61951574d011d363694d6037592e99da9421 upstream.
+
+The variables modeflag and resinfo were only assigned some value but
+were never used.
+
+Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
+Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/video/fbdev/sis/init301.c | 10 ++--------
+ 1 file changed, 2 insertions(+), 8 deletions(-)
+
+--- a/drivers/video/fbdev/sis/init301.c
++++ b/drivers/video/fbdev/sis/init301.c
+@@ -2151,17 +2151,15 @@ SiS_GetVCLK2Ptr(struct SiS_Private *SiS_
+ unsigned short RefreshRateTableIndex)
+ {
+ unsigned short CRT2Index, VCLKIndex = 0, VCLKIndexGEN = 0, VCLKIndexGENCRT = 0;
+- unsigned short modeflag, resinfo, tempbx;
++ unsigned short resinfo, tempbx;
+ const unsigned char *CHTVVCLKPtr = NULL;
+
+ if(ModeNo <= 0x13) {
+- modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag;
+ resinfo = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ResInfo;
+ CRT2Index = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC;
+ VCLKIndexGEN = (SiS_GetRegByte((SiS_Pr->SiS_P3ca+0x02)) >> 2) & 0x03;
+ VCLKIndexGENCRT = VCLKIndexGEN;
+ } else {
+- modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
+ resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO;
+ CRT2Index = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC;
+ VCLKIndexGEN = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRTVCLK;
+@@ -7270,7 +7268,7 @@ SiS_ShiftXPos(struct SiS_Private *SiS_Pr
+ static void
+ SiS_SetGroup4_C_ELV(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned short ModeIdIndex)
+ {
+- unsigned short temp, temp1, resinfo = 0;
++ unsigned short temp, temp1;
+ unsigned char *ROMAddr = SiS_Pr->VirtualRomBase;
+
+ if(!(SiS_Pr->SiS_VBType & VB_SIS30xCLV)) return;
+@@ -7282,10 +7280,6 @@ SiS_SetGroup4_C_ELV(struct SiS_Private *
+ if(!(ROMAddr[0x61] & 0x04)) return;
+ }
+
+- if(ModeNo > 0x13) {
+- resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO;
+- }
+-
+ SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x3a,0x08);
+ temp = SiS_GetReg(SiS_Pr->SiS_Part4Port,0x3a);
+ if(!(temp & 0x01)) {
--- /dev/null
+From 484c7bbf2649831714da3a0fa30213977458e9b5 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Wed, 14 Jun 2017 12:40:36 +0200
+Subject: video: fbdev: via: remove possibly unused variables
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit 484c7bbf2649831714da3a0fa30213977458e9b5 upstream.
+
+When CONFIG_PROC_FS is disabled, we get warnings about unused variables
+as remove_proc_entry() evaluates to an empty macro.
+
+drivers/video/fbdev/via/viafbdev.c: In function 'viafb_remove_proc':
+drivers/video/fbdev/via/viafbdev.c:1635:4: error: unused variable 'iga2_entry' [-Werror=unused-variable]
+drivers/video/fbdev/via/viafbdev.c:1634:4: error: unused variable 'iga1_entry' [-Werror=unused-variable]
+
+These are easy to avoid by using the pointer from the structure.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Cc: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
+Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/video/fbdev/via/viafbdev.c | 8 +++-----
+ 1 file changed, 3 insertions(+), 5 deletions(-)
+
+--- a/drivers/video/fbdev/via/viafbdev.c
++++ b/drivers/video/fbdev/via/viafbdev.c
+@@ -1630,16 +1630,14 @@ static void viafb_init_proc(struct viafb
+ }
+ static void viafb_remove_proc(struct viafb_shared *shared)
+ {
+- struct proc_dir_entry *viafb_entry = shared->proc_entry,
+- *iga1_entry = shared->iga1_proc_entry,
+- *iga2_entry = shared->iga2_proc_entry;
++ struct proc_dir_entry *viafb_entry = shared->proc_entry;
+
+ if (!viafb_entry)
+ return;
+
+- remove_proc_entry("output_devices", iga2_entry);
++ remove_proc_entry("output_devices", shared->iga2_proc_entry);
+ remove_proc_entry("iga2", viafb_entry);
+- remove_proc_entry("output_devices", iga1_entry);
++ remove_proc_entry("output_devices", shared->iga1_proc_entry);
+ remove_proc_entry("iga1", viafb_entry);
+ remove_proc_entry("supported_output_devices", viafb_entry);
+
--- /dev/null
+From 206fc20598157ce15597822cf01b94377e30075b Mon Sep 17 00:00:00 2001
+From: Daniel Wagner <daniel.wagner@bmw-carit.de>
+Date: Tue, 9 Feb 2016 10:18:32 +0100
+Subject: video: Use bool instead int pointer for get_opt_bool() argument
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Daniel Wagner <daniel.wagner@bmw-carit.de>
+
+commit 206fc20598157ce15597822cf01b94377e30075b upstream.
+
+As the function name already indicates that get_opt_bool() parses
+for a bool. It is not a surprise that compiler is complaining
+about it when -Werror=incompatible-pointer-types is used:
+
+drivers/video/fbdev/intelfb/intelfbdrv.c: In function ‘intelfb_setup’:
+drivers/video/fbdev/intelfb/intelfbdrv.c:353:39: error: passing argument 3 of ‘get_opt_bool’ from incompatible pointer type [-Werror=incompatible-pointer-types]
+ if (get_opt_bool(this_opt, "accel", &accel))
+
+Signed-off-by: Daniel Wagner <daniel.wagner@bmw-carit.de>
+Reported-by: Fengguang Wu <fengguang.wu@intel.com>
+Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/video/fbdev/intelfb/intelfbdrv.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/video/fbdev/intelfb/intelfbdrv.c
++++ b/drivers/video/fbdev/intelfb/intelfbdrv.c
+@@ -302,7 +302,7 @@ static __inline__ int get_opt_int(const
+ }
+
+ static __inline__ int get_opt_bool(const char *this_opt, const char *name,
+- int *ret)
++ bool *ret)
+ {
+ if (!ret)
+ return 0;
--- /dev/null
+From f0bb2d50dfcc519f06f901aac88502be6ff1df2c Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Tue, 28 Mar 2017 18:46:59 +0200
+Subject: virtio_balloon: prevent uninitialized variable use
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit f0bb2d50dfcc519f06f901aac88502be6ff1df2c upstream.
+
+The latest gcc-7.0.1 snapshot reports a new warning:
+
+virtio/virtio_balloon.c: In function 'update_balloon_stats':
+virtio/virtio_balloon.c:258:26: error: 'events[2]' is used uninitialized in this function [-Werror=uninitialized]
+virtio/virtio_balloon.c:260:26: error: 'events[3]' is used uninitialized in this function [-Werror=uninitialized]
+virtio/virtio_balloon.c:261:56: error: 'events[18]' is used uninitialized in this function [-Werror=uninitialized]
+virtio/virtio_balloon.c:262:56: error: 'events[17]' is used uninitialized in this function [-Werror=uninitialized]
+
+This seems absolutely right, so we should add an extra check to
+prevent copying uninitialized stack data into the statistics.
+>From all I can tell, this has been broken since the statistics code
+was originally added in 2.6.34.
+
+Fixes: 9564e138b1f6 ("virtio: Add memory statistics reporting to the balloon driver (V4)")
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Ladi Prosek <lprosek@redhat.com>
+Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/virtio/virtio_balloon.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/drivers/virtio/virtio_balloon.c
++++ b/drivers/virtio/virtio_balloon.c
+@@ -239,12 +239,14 @@ static void update_balloon_stats(struct
+ all_vm_events(events);
+ si_meminfo(&i);
+
++#ifdef CONFIG_VM_EVENT_COUNTERS
+ update_stat(vb, idx++, VIRTIO_BALLOON_S_SWAP_IN,
+ pages_to_bytes(events[PSWPIN]));
+ update_stat(vb, idx++, VIRTIO_BALLOON_S_SWAP_OUT,
+ pages_to_bytes(events[PSWPOUT]));
+ update_stat(vb, idx++, VIRTIO_BALLOON_S_MAJFLT, events[PGMAJFAULT]);
+ update_stat(vb, idx++, VIRTIO_BALLOON_S_MINFLT, events[PGFAULT]);
++#endif
+ update_stat(vb, idx++, VIRTIO_BALLOON_S_MEMFREE,
+ pages_to_bytes(i.freeram));
+ update_stat(vb, idx++, VIRTIO_BALLOON_S_MEMTOT,
--- /dev/null
+From fbdf0e28d061708cf18ba0f8e0db5360dc9a15b9 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Fri, 17 Feb 2017 16:08:30 +0100
+Subject: vmxnet3: prevent building with 64K pages
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit fbdf0e28d061708cf18ba0f8e0db5360dc9a15b9 upstream.
+
+I got a warning about broken code on ARM64 with 64K pages:
+
+drivers/net/vmxnet3/vmxnet3_drv.c: In function 'vmxnet3_rq_init':
+drivers/net/vmxnet3/vmxnet3_drv.c:1679:29: error: large integer implicitly truncated to unsigned type [-Werror=overflow]
+ rq->buf_info[0][i].len = PAGE_SIZE;
+
+'len' here is a 16-bit integer, so this clearly won't work. I don't think
+this driver is used much on anything other than x86, so there is no need
+to fix this properly and we can work around it with a Kconfig dependency
+to forbid known-broken configurations. qemu in theory supports it on
+other architectures too, but presumably only for compatibility with x86
+guests that also run on vmware.
+
+CONFIG_PAGE_SIZE_64KB is used on hexagon, mips, sh and tile, the other
+symbols are architecture-specific names for the same thing.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/net/Kconfig | 3 +++
+ 1 file changed, 3 insertions(+)
+
+--- a/drivers/net/Kconfig
++++ b/drivers/net/Kconfig
+@@ -411,6 +411,9 @@ config XEN_NETDEV_BACKEND
+ config VMXNET3
+ tristate "VMware VMXNET3 ethernet driver"
+ depends on PCI && INET
++ depends on !(PAGE_SIZE_64KB || ARM64_64K_PAGES || \
++ IA64_PAGE_SIZE_64KB || MICROBLAZE_64K_PAGES || \
++ PARISC_PAGE_SIZE_64KB || PPC_64K_PAGES)
+ help
+ This driver supports VMware's vmxnet3 virtual ethernet NIC.
+ To compile this driver as a module, choose M here: the
--- /dev/null
+From 836856e3bd61d0644e5178a2c1b51d90459e2788 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Wed, 2 Mar 2016 16:59:02 +0100
+Subject: wireless: cw1200: use __maybe_unused to hide pm functions_
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit 836856e3bd61d0644e5178a2c1b51d90459e2788 upstream.
+
+The cw1200 uses #ifdef to check for CONFIG_PM, but then
+uses SIMPLE_DEV_PM_OPS, which leaves the references out when
+CONFIG_PM_SLEEP is not defined, so we get a warning with
+PM=y && PM_SLEEP=n:
+
+drivers/net/wireless/st/cw1200/cw1200_spi.c:450:12: error: 'cw1200_spi_suspend' defined but not used [-Werror=unused-function]
+
+This removes the incorrect #ifdef and instead uses a __maybe_unused
+annotation to let the compiler know it can silently drop
+the function definition.
+
+For the DEV_PM_OPS definition, we can use an IS_ENABLED() check
+to avoid defining the structure when CONFIG_PM is not set without
+the #ifdef.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/net/wireless/cw1200/cw1200_spi.c | 9 ++-------
+ drivers/net/wireless/cw1200/pm.h | 9 +++++++--
+ 2 files changed, 9 insertions(+), 9 deletions(-)
+
+--- a/drivers/net/wireless/cw1200/cw1200_spi.c
++++ b/drivers/net/wireless/cw1200/cw1200_spi.c
+@@ -446,8 +446,7 @@ static int cw1200_spi_disconnect(struct
+ return 0;
+ }
+
+-#ifdef CONFIG_PM
+-static int cw1200_spi_suspend(struct device *dev)
++static int __maybe_unused cw1200_spi_suspend(struct device *dev)
+ {
+ struct hwbus_priv *self = spi_get_drvdata(to_spi_device(dev));
+
+@@ -460,16 +459,12 @@ static int cw1200_spi_suspend(struct dev
+
+ static SIMPLE_DEV_PM_OPS(cw1200_pm_ops, cw1200_spi_suspend, NULL);
+
+-#endif
+-
+ static struct spi_driver spi_driver = {
+ .probe = cw1200_spi_probe,
+ .remove = cw1200_spi_disconnect,
+ .driver = {
+ .name = "cw1200_wlan_spi",
+-#ifdef CONFIG_PM
+- .pm = &cw1200_pm_ops,
+-#endif
++ .pm = IS_ENABLED(CONFIG_PM) ? &cw1200_pm_ops : NULL,
+ },
+ };
+
+--- a/drivers/net/wireless/cw1200/pm.h
++++ b/drivers/net/wireless/cw1200/pm.h
+@@ -31,13 +31,18 @@ int cw1200_pm_init(struct cw1200_pm_stat
+ void cw1200_pm_deinit(struct cw1200_pm_state *pm);
+ int cw1200_wow_suspend(struct ieee80211_hw *hw,
+ struct cfg80211_wowlan *wowlan);
+-int cw1200_wow_resume(struct ieee80211_hw *hw);
+ int cw1200_can_suspend(struct cw1200_common *priv);
++int cw1200_wow_resume(struct ieee80211_hw *hw);
+ void cw1200_pm_stay_awake(struct cw1200_pm_state *pm,
+ unsigned long tmo);
+ #else
+ static inline void cw1200_pm_stay_awake(struct cw1200_pm_state *pm,
+- unsigned long tmo) {
++ unsigned long tmo)
++{
++}
++static inline int cw1200_can_suspend(struct cw1200_common *priv)
++{
++ return 0;
+ }
+ #endif
+ #endif
--- /dev/null
+From c2ce3f5d89d57301e2756ac325fe2ebc33bfec30 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Wed, 19 Jul 2017 14:53:04 +0200
+Subject: x86: add MULTIUSER dependency for KVM
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit c2ce3f5d89d57301e2756ac325fe2ebc33bfec30 upstream.
+
+KVM tries to select 'TASKSTATS', which had additional dependencies:
+
+warning: (KVM) selects TASKSTATS which has unmet direct dependencies (NET && MULTIUSER)
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/x86/kvm/Kconfig | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/arch/x86/kvm/Kconfig
++++ b/arch/x86/kvm/Kconfig
+@@ -22,7 +22,7 @@ config KVM
+ depends on HAVE_KVM
+ depends on HIGH_RES_TIMERS
+ # for TASKSTATS/TASK_DELAY_ACCT:
+- depends on NET
++ depends on NET && MULTIUSER
+ select PREEMPT_NOTIFIERS
+ select MMU_NOTIFIER
+ select ANON_INODES
--- /dev/null
+From 553bbc11aa6c1f9e0f529a06aeeca15fbe4a3985 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Wed, 16 Nov 2016 15:17:09 +0100
+Subject: x86/boot: Avoid warning for zero-filling .bss
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit 553bbc11aa6c1f9e0f529a06aeeca15fbe4a3985 upstream.
+
+The latest binutils are warning about a .fill directive with an explicit
+value in a .bss section:
+
+ arch/x86/kernel/head_32.S: Assembler messages:
+ arch/x86/kernel/head_32.S:677: Warning: ignoring fill value in section `.bss..page_aligned'
+ arch/x86/kernel/head_32.S:679: Warning: ignoring fill value in section `.bss..page_aligned'
+
+This comes from the 'ENTRY()' macro padding the space between the symbols
+with 'nop' via:
+
+ .align 4,0x90
+
+Open-coding the .globl directive without the padding avoids that warning,
+as all the symbols are already page aligned.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Cc: Andy Lutomirski <luto@kernel.org>
+Cc: Borislav Petkov <bp@alien8.de>
+Cc: Brian Gerst <brgerst@gmail.com>
+Cc: Denys Vlasenko <dvlasenk@redhat.com>
+Cc: H. Peter Anvin <hpa@zytor.com>
+Cc: Josh Poimboeuf <jpoimboe@redhat.com>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Link: http://lkml.kernel.org/r/20161116141726.2013389-1-arnd@arndb.de
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/x86/kernel/head_32.S | 9 ++++++---
+ 1 file changed, 6 insertions(+), 3 deletions(-)
+
+--- a/arch/x86/kernel/head_32.S
++++ b/arch/x86/kernel/head_32.S
+@@ -669,14 +669,17 @@ __PAGE_ALIGNED_BSS
+ initial_pg_pmd:
+ .fill 1024*KPMDS,4,0
+ #else
+-ENTRY(initial_page_table)
++.globl initial_page_table
++initial_page_table:
+ .fill 1024,4,0
+ #endif
+ initial_pg_fixmap:
+ .fill 1024,4,0
+-ENTRY(empty_zero_page)
++.globl empty_zero_page
++empty_zero_page:
+ .fill 4096,1,0
+-ENTRY(swapper_pg_dir)
++.globl swapper_pg_dir
++swapper_pg_dir:
+ .fill 1024,4,0
+
+ /*
--- /dev/null
+From foo@baz Fri Feb 23 17:23:58 CET 2018
+From: Jack Wang <jinpu.wang@profitbricks.com>
+Date: Fri, 23 Feb 2018 11:41:56 +0100
+Subject: x86/bugs: Drop one "mitigation" from dmesg
+To: gregkh@linuxfoundation.org, stable@vger.kernel.org
+Cc: Borislav Petkov <bp@suse.de>, Thomas Gleixner <tglx@linutronix.de>, riel@redhat.com, ak@linux.intel.com, peterz@infradead.org, David Woodhouse <dwmw2@infradead.org>, jikos@kernel.org, luto@amacapital.net, dave.hansen@intel.com, torvalds@linux-foundation.org, keescook@google.com, Josh Poimboeuf <jpoimboe@redhat.com>, tim.c.chen@linux.intel.com, pjt@google.com, David Woodhouse <dwmw@amazon.co.uk>, Jack Wang <jinpu.wang@profitbricks.com>
+Message-ID: <1519382538-15143-8-git-send-email-jinpu.wangl@profitbricks.com>
+
+From: Borislav Petkov <bp@suse.de>
+
+(cherry picked from commit 55fa19d3e51f33d9cd4056d25836d93abf9438db)
+
+Make
+
+[ 0.031118] Spectre V2 mitigation: Mitigation: Full generic retpoline
+
+into
+
+[ 0.031118] Spectre V2: Mitigation: Full generic retpoline
+
+to reduce the mitigation mitigations strings.
+
+Signed-off-by: Borislav Petkov <bp@suse.de>
+Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
+Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Cc: riel@redhat.com
+Cc: ak@linux.intel.com
+Cc: peterz@infradead.org
+Cc: David Woodhouse <dwmw2@infradead.org>
+Cc: jikos@kernel.org
+Cc: luto@amacapital.net
+Cc: dave.hansen@intel.com
+Cc: torvalds@linux-foundation.org
+Cc: keescook@google.com
+Cc: Josh Poimboeuf <jpoimboe@redhat.com>
+Cc: tim.c.chen@linux.intel.com
+Cc: pjt@google.com
+Link: https://lkml.kernel.org/r/20180126121139.31959-5-bp@alien8.de
+Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
+[jwang: port to 4.4]
+Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/x86/kernel/cpu/bugs.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/arch/x86/kernel/cpu/bugs.c
++++ b/arch/x86/kernel/cpu/bugs.c
+@@ -90,7 +90,7 @@ static const char *spectre_v2_strings[]
+ };
+
+ #undef pr_fmt
+-#define pr_fmt(fmt) "Spectre V2 mitigation: " fmt
++#define pr_fmt(fmt) "Spectre V2 : " fmt
+
+ static enum spectre_v2_mitigation spectre_v2_enabled = SPECTRE_V2_NONE;
+
--- /dev/null
+From d460131dd50599e0e9405d5f4ae02c27d529a44a Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Wed, 19 Jul 2017 14:53:03 +0200
+Subject: x86/build: Silence the build with "make -s"
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit d460131dd50599e0e9405d5f4ae02c27d529a44a upstream.
+
+Every kernel build on x86 will result in some output:
+
+ Setup is 13084 bytes (padded to 13312 bytes).
+ System is 4833 kB
+ CRC 6d35fa35
+ Kernel: arch/x86/boot/bzImage is ready (#2)
+
+This shuts it up, so that 'make -s' is truely silent as long as
+everything works. Building without '-s' should produce unchanged
+output.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Matt Fleming <matt@codeblueprint.co.uk>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Link: http://lkml.kernel.org/r/20170719125310.2487451-6-arnd@arndb.de
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/x86/boot/Makefile | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+--- a/arch/x86/boot/Makefile
++++ b/arch/x86/boot/Makefile
+@@ -64,12 +64,13 @@ GCOV_PROFILE := n
+ $(obj)/bzImage: asflags-y := $(SVGA_MODE)
+
+ quiet_cmd_image = BUILD $@
++silent_redirect_image = >/dev/null
+ cmd_image = $(obj)/tools/build $(obj)/setup.bin $(obj)/vmlinux.bin \
+- $(obj)/zoffset.h $@
++ $(obj)/zoffset.h $@ $($(quiet)redirect_image)
+
+ $(obj)/bzImage: $(obj)/setup.bin $(obj)/vmlinux.bin $(obj)/tools/build FORCE
+ $(call if_changed,image)
+- @echo 'Kernel: $@ is ready' ' (#'`cat .version`')'
++ @$(kecho) 'Kernel: $@ is ready' ' (#'`cat .version`')'
+
+ OBJCOPYFLAGS_vmlinux.bin := -O binary -R .note -R .comment -S
+ $(obj)/vmlinux.bin: $(obj)/compressed/vmlinux FORCE
--- /dev/null
+From foo@baz Fri Feb 23 17:23:58 CET 2018
+From: Jack Wang <jinpu.wang@profitbricks.com>
+Date: Fri, 23 Feb 2018 11:41:57 +0100
+Subject: x86/cpu/bugs: Make retpoline module warning conditional
+To: gregkh@linuxfoundation.org, stable@vger.kernel.org
+Cc: Thomas Gleixner <tglx@linutronix.de>, Andi Kleen <ak@linux.intel.com>, David Woodhouse <dwmw2@infradead.org>, David Woodhouse <dwmw@amazon.co.uk>, Jack Wang <jinpu.wang@profitbricks.com>
+Message-ID: <1519382538-15143-9-git-send-email-jinpu.wangl@profitbricks.com>
+
+From: Thomas Gleixner <tglx@linutronix.de>
+
+(cherry picked from commit e383095c7fe8d218e00ec0f83e4b95ed4e627b02)
+
+If sysfs is disabled and RETPOLINE not defined:
+
+arch/x86/kernel/cpu/bugs.c:97:13: warning: ‘spectre_v2_bad_module’ defined but not used
+[-Wunused-variable]
+ static bool spectre_v2_bad_module;
+
+Hide it.
+
+Fixes: caf7501a1b4e ("module/retpoline: Warn about missing retpoline in module")
+Reported-by: Borislav Petkov <bp@alien8.de>
+Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
+Cc: Andi Kleen <ak@linux.intel.com>
+Cc: David Woodhouse <dwmw2@infradead.org>
+Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
+[jwang: port to 4.4]
+Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/x86/kernel/cpu/bugs.c | 12 ++++++++++--
+ 1 file changed, 10 insertions(+), 2 deletions(-)
+
+--- a/arch/x86/kernel/cpu/bugs.c
++++ b/arch/x86/kernel/cpu/bugs.c
+@@ -94,9 +94,10 @@ static const char *spectre_v2_strings[]
+
+ static enum spectre_v2_mitigation spectre_v2_enabled = SPECTRE_V2_NONE;
+
+-static bool spectre_v2_bad_module;
+
+ #ifdef RETPOLINE
++static bool spectre_v2_bad_module;
++
+ bool retpoline_module_ok(bool has_retpoline)
+ {
+ if (spectre_v2_enabled == SPECTRE_V2_NONE || has_retpoline)
+@@ -106,6 +107,13 @@ bool retpoline_module_ok(bool has_retpol
+ spectre_v2_bad_module = true;
+ return false;
+ }
++
++static inline const char *spectre_v2_module_string(void)
++{
++ return spectre_v2_bad_module ? " - vulnerable module loaded" : "";
++}
++#else
++static inline const char *spectre_v2_module_string(void) { return ""; }
+ #endif
+
+ static void __init spec2_print_if_insecure(const char *reason)
+@@ -293,6 +301,6 @@ ssize_t cpu_show_spectre_v2(struct devic
+ return sprintf(buf, "Not affected\n");
+
+ return sprintf(buf, "%s%s\n", spectre_v2_strings[spectre_v2_enabled],
+- spectre_v2_bad_module ? " - vulnerable module loaded" : "");
++ spectre_v2_module_string());
+ }
+ #endif
--- /dev/null
+From 75e2f0a6b16141cb347f442033ec907380d4d66e Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+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@arndb.de>
+
+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@arndb.de>
+Cc: Bill Metzenthen <billm@melbpc.org.au>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Link: http://lkml.kernel.org/r/20170719125310.2487451-3-arnd@arndb.de
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ 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) {
--- /dev/null
+From foo@baz Fri Feb 23 17:23:58 CET 2018
+From: Jack Wang <jinpu.wang@profitbricks.com>
+Date: Fri, 23 Feb 2018 11:42:03 +0100
+Subject: x86/get_user: Use pointer masking to limit speculation
+To: gregkh@linuxfoundation.org, stable@vger.kernel.org
+Cc: Dan Williams <dan.j.williams@intel.com>, Thomas Gleixner <tglx@linutronix.de>, linux-arch@vger.kernel.org, Kees Cook <keescook@chromium.org>, kernel-hardening@lists.openwall.com, Al Viro <viro@zeniv.linux.org.uk>, Andy Lutomirski <luto@kernel.org>, torvalds@linux-foundation.org, alan@linux.intel.com, David Woodhouse <dwmw@amazon.co.uk>, Jack Wang <jinpu.wang@profitbricks.com>
+Message-ID: <1519382538-15143-15-git-send-email-jinpu.wangl@profitbricks.com>
+
+From: Dan Williams <dan.j.williams@intel.com>
+
+(cherry picked from commit c7f631cb07e7da06ac1d231ca178452339e32a94)
+
+Quoting Linus:
+
+ I do think that it would be a good idea to very expressly document
+ the fact that it's not that the user access itself is unsafe. I do
+ agree that things like "get_user()" want to be protected, but not
+ because of any direct bugs or problems with get_user() and friends,
+ but simply because get_user() is an excellent source of a pointer
+ that is obviously controlled from a potentially attacking user
+ space. So it's a prime candidate for then finding _subsequent_
+ accesses that can then be used to perturb the cache.
+
+Unlike the __get_user() case get_user() includes the address limit check
+near the pointer de-reference. With that locality the speculation can be
+mitigated with pointer narrowing rather than a barrier, i.e.
+array_index_nospec(). Where the narrowing is performed by:
+
+ cmp %limit, %ptr
+ sbb %mask, %mask
+ and %mask, %ptr
+
+With respect to speculation the value of %ptr is either less than %limit
+or NULL.
+
+Co-developed-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Dan Williams <dan.j.williams@intel.com>
+Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
+Cc: linux-arch@vger.kernel.org
+Cc: Kees Cook <keescook@chromium.org>
+Cc: kernel-hardening@lists.openwall.com
+Cc: gregkh@linuxfoundation.org
+Cc: Al Viro <viro@zeniv.linux.org.uk>
+Cc: Andy Lutomirski <luto@kernel.org>
+Cc: torvalds@linux-foundation.org
+Cc: alan@linux.intel.com
+Link: https://lkml.kernel.org/r/151727417469.33451.11804043010080838495.stgit@dwillia2-desk3.amr.corp.intel.com
+Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
+[jwang: port to 4.4]
+Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/x86/lib/getuser.S | 10 ++++++++++
+ 1 file changed, 10 insertions(+)
+
+--- a/arch/x86/lib/getuser.S
++++ b/arch/x86/lib/getuser.S
+@@ -38,6 +38,8 @@ ENTRY(__get_user_1)
+ GET_THREAD_INFO(%_ASM_DX)
+ cmp TI_addr_limit(%_ASM_DX),%_ASM_AX
+ jae bad_get_user
++ sbb %_ASM_DX, %_ASM_DX /* array_index_mask_nospec() */
++ and %_ASM_DX, %_ASM_AX
+ ASM_STAC
+ 1: movzbl (%_ASM_AX),%edx
+ xor %eax,%eax
+@@ -51,6 +53,8 @@ ENTRY(__get_user_2)
+ GET_THREAD_INFO(%_ASM_DX)
+ cmp TI_addr_limit(%_ASM_DX),%_ASM_AX
+ jae bad_get_user
++ sbb %_ASM_DX, %_ASM_DX /* array_index_mask_nospec() */
++ and %_ASM_DX, %_ASM_AX
+ ASM_STAC
+ 2: movzwl -1(%_ASM_AX),%edx
+ xor %eax,%eax
+@@ -64,6 +68,8 @@ ENTRY(__get_user_4)
+ GET_THREAD_INFO(%_ASM_DX)
+ cmp TI_addr_limit(%_ASM_DX),%_ASM_AX
+ jae bad_get_user
++ sbb %_ASM_DX, %_ASM_DX /* array_index_mask_nospec() */
++ and %_ASM_DX, %_ASM_AX
+ ASM_STAC
+ 3: movl -3(%_ASM_AX),%edx
+ xor %eax,%eax
+@@ -78,6 +84,8 @@ ENTRY(__get_user_8)
+ GET_THREAD_INFO(%_ASM_DX)
+ cmp TI_addr_limit(%_ASM_DX),%_ASM_AX
+ jae bad_get_user
++ sbb %_ASM_DX, %_ASM_DX /* array_index_mask_nospec() */
++ and %_ASM_DX, %_ASM_AX
+ ASM_STAC
+ 4: movq -7(%_ASM_AX),%rdx
+ xor %eax,%eax
+@@ -89,6 +97,8 @@ ENTRY(__get_user_8)
+ GET_THREAD_INFO(%_ASM_DX)
+ cmp TI_addr_limit(%_ASM_DX),%_ASM_AX
+ jae bad_get_user_8
++ sbb %_ASM_DX, %_ASM_DX /* array_index_mask_nospec() */
++ and %_ASM_DX, %_ASM_AX
+ ASM_STAC
+ 4: movl -7(%_ASM_AX),%edx
+ 5: movl -3(%_ASM_AX),%ecx
--- /dev/null
+From foo@baz Fri Feb 23 17:23:58 CET 2018
+From: Jack Wang <jinpu.wang@profitbricks.com>
+Date: Fri, 23 Feb 2018 11:42:01 +0100
+Subject: x86: Implement array_index_mask_nospec
+To: gregkh@linuxfoundation.org, stable@vger.kernel.org
+Cc: Dan Williams <dan.j.williams@intel.com>, Thomas Gleixner <tglx@linutronix.de>, linux-arch@vger.kernel.org, kernel-hardening@lists.openwall.com, alan@linux.intel.com, David Woodhouse <dwmw@amazon.co.uk>, Jack Wang <jinpu.wang@profitbricks.com>
+Message-ID: <1519382538-15143-13-git-send-email-jinpu.wangl@profitbricks.com>
+
+From: Dan Williams <dan.j.williams@intel.com>
+
+(cherry picked from commit babdde2698d482b6c0de1eab4f697cf5856c5859)
+
+array_index_nospec() uses a mask to sanitize user controllable array
+indexes, i.e. generate a 0 mask if 'index' >= 'size', and a ~0 mask
+otherwise. While the default array_index_mask_nospec() handles the
+carry-bit from the (index - size) result in software.
+
+The x86 array_index_mask_nospec() does the same, but the carry-bit is
+handled in the processor CF flag without conditional instructions in the
+control flow.
+
+Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Dan Williams <dan.j.williams@intel.com>
+Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
+Cc: linux-arch@vger.kernel.org
+Cc: kernel-hardening@lists.openwall.com
+Cc: gregkh@linuxfoundation.org
+Cc: alan@linux.intel.com
+Link: https://lkml.kernel.org/r/151727414808.33451.1873237130672785331.stgit@dwillia2-desk3.amr.corp.intel.com
+Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
+[jwang:chery pick to 4.4]
+Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/x86/include/asm/barrier.h | 24 ++++++++++++++++++++++++
+ 1 file changed, 24 insertions(+)
+
+--- a/arch/x86/include/asm/barrier.h
++++ b/arch/x86/include/asm/barrier.h
+@@ -24,6 +24,30 @@
+ #define wmb() asm volatile("sfence" ::: "memory")
+ #endif
+
++/**
++ * array_index_mask_nospec() - generate a mask that is ~0UL when the
++ * bounds check succeeds and 0 otherwise
++ * @index: array element index
++ * @size: number of elements in array
++ *
++ * Returns:
++ * 0 - (index < size)
++ */
++static inline unsigned long array_index_mask_nospec(unsigned long index,
++ unsigned long size)
++{
++ unsigned long mask;
++
++ asm ("cmp %1,%2; sbb %0,%0;"
++ :"=r" (mask)
++ :"r"(size),"r" (index)
++ :"cc");
++ return mask;
++}
++
++/* Override the default implementation from linux/nospec.h. */
++#define array_index_mask_nospec array_index_mask_nospec
++
+ #ifdef CONFIG_X86_PPRO_FENCE
+ #define dma_rmb() rmb()
+ #else
--- /dev/null
+From foo@baz Fri Feb 23 17:23:58 CET 2018
+From: Jack Wang <jinpu.wang@profitbricks.com>
+Date: Fri, 23 Feb 2018 11:42:02 +0100
+Subject: x86: Introduce barrier_nospec
+To: gregkh@linuxfoundation.org, stable@vger.kernel.org
+Cc: Dan Williams <dan.j.williams@intel.com>, Thomas Gleixner <tglx@linutronix.de>, linux-arch@vger.kernel.org, Tom Lendacky <thomas.lendacky@amd.com>, Kees Cook <keescook@chromium.org>, kernel-hardening@lists.openwall.com, Al Viro <viro@zeniv.linux.org.uk>, alan@linux.intel.com, David Woodhouse <dwmw@amazon.co.uk>, Jack Wang <jinpu.wang@profitbricks.com>
+Message-ID: <1519382538-15143-14-git-send-email-jinpu.wangl@profitbricks.com>
+
+From: Dan Williams <dan.j.williams@intel.com>
+
+(cherry picked from commit b3d7ad85b80bbc404635dca80f5b129f6242bc7a)
+
+Rename the open coded form of this instruction sequence from
+rdtsc_ordered() into a generic barrier primitive, barrier_nospec().
+
+One of the mitigations for Spectre variant1 vulnerabilities is to fence
+speculative execution after successfully validating a bounds check. I.e.
+force the result of a bounds check to resolve in the instruction pipeline
+to ensure speculative execution honors that result before potentially
+operating on out-of-bounds data.
+
+No functional changes.
+
+Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
+Suggested-by: Andi Kleen <ak@linux.intel.com>
+Suggested-by: Ingo Molnar <mingo@redhat.com>
+Signed-off-by: Dan Williams <dan.j.williams@intel.com>
+Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
+Cc: linux-arch@vger.kernel.org
+Cc: Tom Lendacky <thomas.lendacky@amd.com>
+Cc: Kees Cook <keescook@chromium.org>
+Cc: kernel-hardening@lists.openwall.com
+Cc: gregkh@linuxfoundation.org
+Cc: Al Viro <viro@zeniv.linux.org.uk>
+Cc: alan@linux.intel.com
+Link: https://lkml.kernel.org/r/151727415361.33451.9049453007262764675.stgit@dwillia2-desk3.amr.corp.intel.com
+Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
+[jwang: cherry pick to 4.4]
+Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/x86/include/asm/barrier.h | 4 ++++
+ arch/x86/include/asm/msr.h | 3 +--
+ 2 files changed, 5 insertions(+), 2 deletions(-)
+
+--- a/arch/x86/include/asm/barrier.h
++++ b/arch/x86/include/asm/barrier.h
+@@ -48,6 +48,10 @@ static inline unsigned long array_index_
+ /* Override the default implementation from linux/nospec.h. */
+ #define array_index_mask_nospec array_index_mask_nospec
+
++/* Prevent speculative execution past this barrier. */
++#define barrier_nospec() alternative_2("", "mfence", X86_FEATURE_MFENCE_RDTSC, \
++ "lfence", X86_FEATURE_LFENCE_RDTSC)
++
+ #ifdef CONFIG_X86_PPRO_FENCE
+ #define dma_rmb() rmb()
+ #else
+--- a/arch/x86/include/asm/msr.h
++++ b/arch/x86/include/asm/msr.h
+@@ -147,8 +147,7 @@ static __always_inline unsigned long lon
+ * that some other imaginary CPU is updating continuously with a
+ * time stamp.
+ */
+- alternative_2("", "mfence", X86_FEATURE_MFENCE_RDTSC,
+- "lfence", X86_FEATURE_LFENCE_RDTSC);
++ barrier_nospec();
+ return rdtsc();
+ }
+
--- /dev/null
+From foo@baz Fri Feb 23 17:23:58 CET 2018
+From: Jack Wang <jinpu.wang@profitbricks.com>
+Date: Fri, 23 Feb 2018 11:42:10 +0100
+Subject: x86/kvm: Update spectre-v1 mitigation
+To: gregkh@linuxfoundation.org, stable@vger.kernel.org
+Cc: Dan Williams <dan.j.williams@intel.com>, Thomas Gleixner <tglx@linutronix.de>, Andrew Honig <ahonig@google.com>, kvm@vger.kernel.org, Jim Mattson <jmattson@google.com>, David Woodhouse <dwmw@amazon.co.uk>, Jack Wang <jinpu.wang@profitbricks.com>
+Message-ID: <1519382538-15143-22-git-send-email-jinpu.wangl@profitbricks.com>
+
+From: Dan Williams <dan.j.williams@intel.com>
+
+(cherry picked from commit 085331dfc6bbe3501fb936e657331ca943827600)
+
+Commit 75f139aaf896 "KVM: x86: Add memory barrier on vmcs field lookup"
+added a raw 'asm("lfence");' to prevent a bounds check bypass of
+'vmcs_field_to_offset_table'.
+
+The lfence can be avoided in this path by using the array_index_nospec()
+helper designed for these types of fixes.
+
+Signed-off-by: Dan Williams <dan.j.williams@intel.com>
+Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
+Acked-by: Paolo Bonzini <pbonzini@redhat.com>
+Cc: Andrew Honig <ahonig@google.com>
+Cc: kvm@vger.kernel.org
+Cc: Jim Mattson <jmattson@google.com>
+Link: https://lkml.kernel.org/r/151744959670.6342.3001723920950249067.stgit@dwillia2-desk3.amr.corp.intel.com
+Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
+[jwang: cherry pick to 4.4]
+Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/x86/kvm/vmx.c | 20 +++++++++-----------
+ 1 file changed, 9 insertions(+), 11 deletions(-)
+
+--- a/arch/x86/kvm/vmx.c
++++ b/arch/x86/kvm/vmx.c
+@@ -32,6 +32,7 @@
+ #include <linux/slab.h>
+ #include <linux/tboot.h>
+ #include <linux/hrtimer.h>
++#include <linux/nospec.h>
+ #include "kvm_cache_regs.h"
+ #include "x86.h"
+
+@@ -827,21 +828,18 @@ static const unsigned short vmcs_field_t
+
+ static inline short vmcs_field_to_offset(unsigned long field)
+ {
+- BUILD_BUG_ON(ARRAY_SIZE(vmcs_field_to_offset_table) > SHRT_MAX);
++ const size_t size = ARRAY_SIZE(vmcs_field_to_offset_table);
++ unsigned short offset;
+
+- if (field >= ARRAY_SIZE(vmcs_field_to_offset_table))
++ BUILD_BUG_ON(size > SHRT_MAX);
++ if (field >= size)
+ return -ENOENT;
+
+- /*
+- * FIXME: Mitigation for CVE-2017-5753. To be replaced with a
+- * generic mechanism.
+- */
+- asm("lfence");
+-
+- if (vmcs_field_to_offset_table[field] == 0)
++ field = array_index_nospec(field, size);
++ offset = vmcs_field_to_offset_table[field];
++ if (offset == 0)
+ return -ENOENT;
+-
+- return vmcs_field_to_offset_table[field];
++ return offset;
+ }
+
+ static inline struct vmcs12 *get_vmcs12(struct kvm_vcpu *vcpu)
--- /dev/null
+From foo@baz Fri Feb 23 17:12:49 CET 2018
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Tue, 20 Feb 2018 12:55:05 +0100
+Subject: x86/microcode/AMD: Change load_microcode_amd()'s param to bool to fix preemptibility bug
+To: stable@vger.kernel.org
+Cc: Greg KH <gregkh@linuxfoundation.org>, linux-kernel@vger.kernel.org, Borislav Petkov <bp@suse.de>, Linus Torvalds <torvalds@linux-foundation.org>, Peter Zijlstra <peterz@infradead.org>, Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@kernel.org>, Arnd Bergmann <arnd@arndb.de>, Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>, x86@kernel.org, Borislav Petkov <bp@alien8.de>, Tom Lendacky <thomas.lendacky@amd.com>
+Message-ID: <20180220115527.1806578-19-arnd@arndb.de>
+
+From: Borislav Petkov <bp@suse.de>
+
+commit dac6ca243c4c49a9ca7507d3d66140ebfac8b04b upstream.
+
+With CONFIG_DEBUG_PREEMPT enabled, I get:
+
+ BUG: using smp_processor_id() in preemptible [00000000] code: swapper/0/1
+ caller is debug_smp_processor_id
+ CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.12.0-rc2+ #2
+ Call Trace:
+ dump_stack
+ check_preemption_disabled
+ debug_smp_processor_id
+ save_microcode_in_initrd_amd
+ ? microcode_init
+ save_microcode_in_initrd
+ ...
+
+because, well, it says it above, we're using smp_processor_id() in
+preemptible code.
+
+But passing the CPU number is not really needed. It is only used to
+determine whether we're on the BSP, and, if so, to save the microcode
+patch for early loading.
+
+ [ We don't absolutely need to do it on the BSP but we do that
+ customarily there. ]
+
+Instead, convert that function parameter to a boolean which denotes
+whether the patch should be saved or not, thereby avoiding the use of
+smp_processor_id() in preemptible code.
+
+Signed-off-by: Borislav Petkov <bp@suse.de>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Link: http://lkml.kernel.org/r/20170528200414.31305-1-bp@alien8.de
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+[arnd: rebased to 4.9, after running into warning:
+ arch/x86/kernel/cpu/microcode/amd.c:881:30: self-comparison always evaluates to true]
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/x86/include/asm/microcode_amd.h | 1 -
+ arch/x86/kernel/cpu/microcode/amd.c | 17 +++++++++++------
+ 2 files changed, 11 insertions(+), 7 deletions(-)
+
+--- a/arch/x86/include/asm/microcode_amd.h
++++ b/arch/x86/include/asm/microcode_amd.h
+@@ -59,7 +59,6 @@ static inline u16 find_equiv_id(struct e
+
+ extern int __apply_microcode_amd(struct microcode_amd *mc_amd);
+ extern int apply_microcode_amd(int cpu);
+-extern enum ucode_state load_microcode_amd(int cpu, u8 family, const u8 *data, size_t size);
+
+ #define PATCH_MAX_SIZE PAGE_SIZE
+ extern u8 amd_ucode_patch[PATCH_MAX_SIZE];
+--- a/arch/x86/kernel/cpu/microcode/amd.c
++++ b/arch/x86/kernel/cpu/microcode/amd.c
+@@ -131,6 +131,9 @@ static size_t compute_container_size(u8
+ return size;
+ }
+
++static enum ucode_state
++load_microcode_amd(bool save, u8 family, const u8 *data, size_t size);
++
+ /*
+ * Early load occurs before we can vmalloc(). So we look for the microcode
+ * patch container file in initrd, traverse equivalent cpu table, look for a
+@@ -438,7 +441,7 @@ int __init save_microcode_in_initrd_amd(
+ eax = cpuid_eax(0x00000001);
+ eax = ((eax >> 8) & 0xf) + ((eax >> 20) & 0xff);
+
+- ret = load_microcode_amd(smp_processor_id(), eax, container, container_size);
++ ret = load_microcode_amd(true, eax, container, container_size);
+ if (ret != UCODE_OK)
+ retval = -EINVAL;
+
+@@ -854,7 +857,8 @@ static enum ucode_state __load_microcode
+ return UCODE_OK;
+ }
+
+-enum ucode_state load_microcode_amd(int cpu, u8 family, const u8 *data, size_t size)
++static enum ucode_state
++load_microcode_amd(bool save, u8 family, const u8 *data, size_t size)
+ {
+ enum ucode_state ret;
+
+@@ -868,8 +872,8 @@ enum ucode_state load_microcode_amd(int
+
+ #ifdef CONFIG_X86_32
+ /* save BSP's matching patch for early load */
+- if (cpu_data(cpu).cpu_index == boot_cpu_data.cpu_index) {
+- struct ucode_patch *p = find_patch(cpu);
++ if (save) {
++ struct ucode_patch *p = find_patch(0);
+ if (p) {
+ memset(amd_ucode_patch, 0, PATCH_MAX_SIZE);
+ memcpy(amd_ucode_patch, p->data, min_t(u32, ksize(p->data),
+@@ -901,11 +905,12 @@ static enum ucode_state request_microcod
+ {
+ char fw_name[36] = "amd-ucode/microcode_amd.bin";
+ struct cpuinfo_x86 *c = &cpu_data(cpu);
++ bool bsp = c->cpu_index == boot_cpu_data.cpu_index;
+ enum ucode_state ret = UCODE_NFOUND;
+ const struct firmware *fw;
+
+ /* reload ucode container only on the boot cpu */
+- if (!refresh_fw || c->cpu_index != boot_cpu_data.cpu_index)
++ if (!refresh_fw || !bsp)
+ return UCODE_OK;
+
+ if (c->x86 >= 0x15)
+@@ -922,7 +927,7 @@ static enum ucode_state request_microcod
+ goto fw_release;
+ }
+
+- ret = load_microcode_amd(cpu, c->x86, fw->data, fw->size);
++ ret = load_microcode_amd(bsp, c->x86, fw->data, fw->size);
+
+ fw_release:
+ release_firmware(fw);
--- /dev/null
+From foo@baz Fri Feb 23 17:23:58 CET 2018
+From: Jack Wang <jinpu.wang@profitbricks.com>
+Date: Fri, 23 Feb 2018 11:41:55 +0100
+Subject: x86/nospec: Fix header guards names
+To: gregkh@linuxfoundation.org, stable@vger.kernel.org
+Cc: Borislav Petkov <bp@suse.de>, Thomas Gleixner <tglx@linutronix.de>, riel@redhat.com, ak@linux.intel.com, peterz@infradead.org, David Woodhouse <dwmw2@infradead.org>, jikos@kernel.org, luto@amacapital.net, dave.hansen@intel.com, torvalds@linux-foundation.org, keescook@google.com, Josh Poimboeuf <jpoimboe@redhat.com>, tim.c.chen@linux.intel.com, gregkh@linux-foundation.org, pjt@google.com, David Woodhouse <dwmw@amazon.co.uk>, Jack Wang <jinpu.wang@profitbricks.com>
+Message-ID: <1519382538-15143-7-git-send-email-jinpu.wangl@profitbricks.com>
+
+From: Borislav Petkov <bp@suse.de>
+
+(cherry picked from commit 7a32fc51ca938e67974cbb9db31e1a43f98345a9)
+
+... to adhere to the _ASM_X86_ naming scheme.
+
+No functional change.
+
+Signed-off-by: Borislav Petkov <bp@suse.de>
+Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
+Cc: riel@redhat.com
+Cc: ak@linux.intel.com
+Cc: peterz@infradead.org
+Cc: David Woodhouse <dwmw2@infradead.org>
+Cc: jikos@kernel.org
+Cc: luto@amacapital.net
+Cc: dave.hansen@intel.com
+Cc: torvalds@linux-foundation.org
+Cc: keescook@google.com
+Cc: Josh Poimboeuf <jpoimboe@redhat.com>
+Cc: tim.c.chen@linux.intel.com
+Cc: gregkh@linux-foundation.org
+Cc: pjt@google.com
+Link: https://lkml.kernel.org/r/20180126121139.31959-3-bp@alien8.de
+Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
+[cherry-pick to 4.4]
+Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/x86/include/asm/nospec-branch.h | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+--- a/arch/x86/include/asm/nospec-branch.h
++++ b/arch/x86/include/asm/nospec-branch.h
+@@ -1,7 +1,7 @@
+ /* SPDX-License-Identifier: GPL-2.0 */
+
+-#ifndef __NOSPEC_BRANCH_H__
+-#define __NOSPEC_BRANCH_H__
++#ifndef _ASM_X86_NOSPEC_BRANCH_H_
++#define _ASM_X86_NOSPEC_BRANCH_H_
+
+ #include <asm/alternative.h>
+ #include <asm/alternative-asm.h>
+@@ -195,4 +195,4 @@ static inline void vmexit_fill_RSB(void)
+ }
+
+ #endif /* __ASSEMBLY__ */
+-#endif /* __NOSPEC_BRANCH_H__ */
++#endif /* _ASM_X86_NOSPEC_BRANCH_H_ */
--- /dev/null
+From foo@baz Fri Feb 23 17:23:58 CET 2018
+From: Jack Wang <jinpu.wang@profitbricks.com>
+Date: Fri, 23 Feb 2018 11:42:09 +0100
+Subject: x86/paravirt: Remove 'noreplace-paravirt' cmdline option
+To: gregkh@linuxfoundation.org, stable@vger.kernel.org
+Cc: Josh Poimboeuf <jpoimboe@redhat.com>, Thomas Gleixner <tglx@linutronix.de>, Andrea Arcangeli <aarcange@redhat.com>, Peter Zijlstra <peterz@infradead.org>, Andi Kleen <ak@linux.intel.com>, Ashok Raj <ashok.raj@intel.com>, Jun Nakajima <jun.nakajima@intel.com>, Tim Chen <tim.c.chen@linux.intel.com>, Rusty Russell <rusty@rustcorp.com.au>, Dave Hansen <dave.hansen@intel.com>, Asit Mallick <asit.k.mallick@intel.com>, Andy Lutomirski <luto@kernel.org>, Linus Torvalds <torvalds@linux-foundation.org>, Jason Baron <jbaron@akamai.com>, Paolo Bonzini <pbonzini@redhat.com>, Alok Kataria <akataria@vmware.com>, Arjan Van De Ven <arjan.van.de.ven@intel.com>, David Woodhouse <dwmw2@infradead.org>, Dan Williams <dan.j.williams@intel.com>, David Woodhouse <dwmw@amazon.co.uk>, Jack Wang <jinpu.wang@profitbricks.com>
+Message-ID: <1519382538-15143-21-git-send-email-jinpu.wangl@profitbricks.com>
+
+From: Josh Poimboeuf <jpoimboe@redhat.com>
+
+(cherry picked from commit 12c69f1e94c89d40696e83804dd2f0965b5250cd)
+
+The 'noreplace-paravirt' option disables paravirt patching, leaving the
+original pv indirect calls in place.
+
+That's highly incompatible with retpolines, unless we want to uglify
+paravirt even further and convert the paravirt calls to retpolines.
+
+As far as I can tell, the option doesn't seem to be useful for much
+other than introducing surprising corner cases and making the kernel
+vulnerable to Spectre v2. It was probably a debug option from the early
+paravirt days. So just remove it.
+
+Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
+Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
+Reviewed-by: Juergen Gross <jgross@suse.com>
+Cc: Andrea Arcangeli <aarcange@redhat.com>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Andi Kleen <ak@linux.intel.com>
+Cc: Ashok Raj <ashok.raj@intel.com>
+Cc: Greg KH <gregkh@linuxfoundation.org>
+Cc: Jun Nakajima <jun.nakajima@intel.com>
+Cc: Tim Chen <tim.c.chen@linux.intel.com>
+Cc: Rusty Russell <rusty@rustcorp.com.au>
+Cc: Dave Hansen <dave.hansen@intel.com>
+Cc: Asit Mallick <asit.k.mallick@intel.com>
+Cc: Andy Lutomirski <luto@kernel.org>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Jason Baron <jbaron@akamai.com>
+Cc: Paolo Bonzini <pbonzini@redhat.com>
+Cc: Alok Kataria <akataria@vmware.com>
+Cc: Arjan Van De Ven <arjan.van.de.ven@intel.com>
+Cc: David Woodhouse <dwmw2@infradead.org>
+Cc: Dan Williams <dan.j.williams@intel.com>
+Link: https://lkml.kernel.org/r/20180131041333.2x6blhxirc2kclrq@treble
+Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
+[jwang: chery pick to 4.4]
+Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ Documentation/kernel-parameters.txt | 2 --
+ arch/x86/kernel/alternative.c | 14 --------------
+ 2 files changed, 16 deletions(-)
+
+--- a/Documentation/kernel-parameters.txt
++++ b/Documentation/kernel-parameters.txt
+@@ -2565,8 +2565,6 @@ bytes respectively. Such letter suffixes
+ norandmaps Don't use address space randomization. Equivalent to
+ echo 0 > /proc/sys/kernel/randomize_va_space
+
+- noreplace-paravirt [X86,IA-64,PV_OPS] Don't patch paravirt_ops
+-
+ noreplace-smp [X86-32,SMP] Don't replace SMP instructions
+ with UP alternatives
+
+--- a/arch/x86/kernel/alternative.c
++++ b/arch/x86/kernel/alternative.c
+@@ -45,17 +45,6 @@ static int __init setup_noreplace_smp(ch
+ }
+ __setup("noreplace-smp", setup_noreplace_smp);
+
+-#ifdef CONFIG_PARAVIRT
+-static int __initdata_or_module noreplace_paravirt = 0;
+-
+-static int __init setup_noreplace_paravirt(char *str)
+-{
+- noreplace_paravirt = 1;
+- return 1;
+-}
+-__setup("noreplace-paravirt", setup_noreplace_paravirt);
+-#endif
+-
+ #define DPRINTK(fmt, args...) \
+ do { \
+ if (debug_alternative) \
+@@ -587,9 +576,6 @@ void __init_or_module apply_paravirt(str
+ struct paravirt_patch_site *p;
+ char insnbuf[MAX_PATCH_LEN];
+
+- if (noreplace_paravirt)
+- return;
+-
+ for (p = start; p < end; p++) {
+ unsigned int used;
+
--- /dev/null
+From d689c64d189e43d782fec5649fb0afe303c5b3f9 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Wed, 19 Jul 2017 14:53:05 +0200
+Subject: x86/platform: Add PCI dependency for PUNIT_ATOM_DEBUG
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit d689c64d189e43d782fec5649fb0afe303c5b3f9 upstream.
+
+The IOSF_MBI option requires PCI support, without it we get a harmless
+Kconfig warning when it gets selected by PUNIT_ATOM_DEBUG:
+
+ warning: (X86_INTEL_LPSS && SND_SST_IPC_ACPI && MMC_SDHCI_ACPI && PUNIT_ATOM_DEBUG) selects IOSF_MBI which has unmet direct dependencies (PCI)
+
+This adds another dependency to avoid the warning.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Cc: Andy Lutomirski <luto@kernel.org>
+Cc: Josh Poimboeuf <jpoimboe@redhat.com>
+Cc: Kees Cook <keescook@chromium.org>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Link: http://lkml.kernel.org/r/20170719125310.2487451-8-arnd@arndb.de
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/x86/Kconfig.debug | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/arch/x86/Kconfig.debug
++++ b/arch/x86/Kconfig.debug
+@@ -391,6 +391,7 @@ config X86_DEBUG_FPU
+
+ config PUNIT_ATOM_DEBUG
+ tristate "ATOM Punit debug driver"
++ depends on PCI
+ select DEBUG_FS
+ select IOSF_MBI
+ ---help---
--- /dev/null
+From 20ab6677716c7bbdcfd1cdb9aef296a0b3101f73 Mon Sep 17 00:00:00 2001
+From: Borislav Petkov <bp@suse.de>
+Date: Sat, 26 Nov 2016 15:27:06 +0100
+Subject: x86/platform/olpc: Fix resume handler build warning
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Borislav Petkov <bp@suse.de>
+
+commit 20ab6677716c7bbdcfd1cdb9aef296a0b3101f73 upstream.
+
+Fix:
+
+ arch/x86/platform/olpc/olpc-xo15-sci.c:199:12: warning: ‘xo15_sci_resume’
+ defined but not used [-Wunused-function]
+ static int xo15_sci_resume(struct device *dev)
+ ^
+
+which I see in randconfig builds here.
+
+Signed-off-by: Borislav Petkov <bp@suse.de>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Link: http://lkml.kernel.org/r/20161126142706.13602-1-bp@alien8.de
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/x86/platform/olpc/olpc-xo15-sci.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/arch/x86/platform/olpc/olpc-xo15-sci.c
++++ b/arch/x86/platform/olpc/olpc-xo15-sci.c
+@@ -196,6 +196,7 @@ static int xo15_sci_remove(struct acpi_d
+ return 0;
+ }
+
++#ifdef CONFIG_PM_SLEEP
+ static int xo15_sci_resume(struct device *dev)
+ {
+ /* Enable all EC events */
+@@ -207,6 +208,7 @@ static int xo15_sci_resume(struct device
+
+ return 0;
+ }
++#endif
+
+ static SIMPLE_DEV_PM_OPS(xo15_sci_pm, NULL, xo15_sci_resume);
+
--- /dev/null
+From d4b2ac63b0eae461fc10c9791084be24724ef57a Mon Sep 17 00:00:00 2001
+From: Borislav Petkov <bp@suse.de>
+Date: Mon, 23 Jan 2017 19:35:06 +0100
+Subject: x86/ras/inject: Make it depend on X86_LOCAL_APIC=y
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Borislav Petkov <bp@suse.de>
+
+commit d4b2ac63b0eae461fc10c9791084be24724ef57a upstream.
+
+... and get rid of the annoying:
+
+ arch/x86/kernel/cpu/mcheck/mce-inject.c:97:13: warning: ‘mce_irq_ipi’ defined but not used [-Wunused-function]
+
+when doing randconfig builds.
+
+Signed-off-by: Borislav Petkov <bp@suse.de>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Cc: Tony Luck <tony.luck@intel.com>
+Cc: Yazen Ghannam <Yazen.Ghannam@amd.com>
+Cc: linux-edac <linux-edac@vger.kernel.org>
+Link: http://lkml.kernel.org/r/20170123183514.13356-2-bp@alien8.de
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/x86/Kconfig | 2 +-
+ arch/x86/kernel/cpu/mcheck/mce-inject.c | 5 +----
+ 2 files changed, 2 insertions(+), 5 deletions(-)
+
+--- a/arch/x86/Kconfig
++++ b/arch/x86/Kconfig
+@@ -1009,7 +1009,7 @@ config X86_MCE_THRESHOLD
+ def_bool y
+
+ config X86_MCE_INJECT
+- depends on X86_MCE
++ depends on X86_MCE && X86_LOCAL_APIC
+ tristate "Machine check injector support"
+ ---help---
+ Provide support for injecting machine checks for testing purposes.
+--- a/arch/x86/kernel/cpu/mcheck/mce-inject.c
++++ b/arch/x86/kernel/cpu/mcheck/mce-inject.c
+@@ -152,7 +152,6 @@ static void raise_mce(struct mce *m)
+ if (context == MCJ_CTX_RANDOM)
+ return;
+
+-#ifdef CONFIG_X86_LOCAL_APIC
+ if (m->inject_flags & (MCJ_IRQ_BROADCAST | MCJ_NMI_BROADCAST)) {
+ unsigned long start;
+ int cpu;
+@@ -193,9 +192,7 @@ static void raise_mce(struct mce *m)
+ raise_local();
+ put_cpu();
+ put_online_cpus();
+- } else
+-#endif
+- {
++ } else {
+ preempt_disable();
+ raise_local();
+ preempt_enable();
--- /dev/null
+From foo@baz Fri Feb 23 17:23:58 CET 2018
+From: Jack Wang <jinpu.wang@profitbricks.com>
+Date: Fri, 23 Feb 2018 11:42:11 +0100
+Subject: x86/retpoline: Avoid retpolines for built-in __init functions
+To: gregkh@linuxfoundation.org, stable@vger.kernel.org
+Cc: David Woodhouse <dwmw@amazon.co.uk>, Thomas Gleixner <tglx@linutronix.de>, karahmed@amazon.de, peterz@infradead.org, bp@alien8.de, Jack Wang <jinpu.wang@profitbricks.com>
+Message-ID: <1519382538-15143-23-git-send-email-jinpu.wangl@profitbricks.com>
+
+From: David Woodhouse <dwmw@amazon.co.uk>
+
+(cherry picked from commit 66f793099a636862a71c59d4a6ba91387b155e0c)
+
+There's no point in building init code with retpolines, since it runs before
+any potentially hostile userspace does. And before the retpoline is actually
+ALTERNATIVEd into place, for much of it.
+
+Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
+Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
+Cc: karahmed@amazon.de
+Cc: peterz@infradead.org
+Cc: bp@alien8.de
+Link: https://lkml.kernel.org/r/1517484441-1420-2-git-send-email-dwmw@amazon.co.uk
+Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
+[jwang: port to 4.4]
+Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ include/linux/init.h | 9 ++++++++-
+ 1 file changed, 8 insertions(+), 1 deletion(-)
+
+--- a/include/linux/init.h
++++ b/include/linux/init.h
+@@ -4,6 +4,13 @@
+ #include <linux/compiler.h>
+ #include <linux/types.h>
+
++/* Built-in __init functions needn't be compiled with retpoline */
++#if defined(RETPOLINE) && !defined(MODULE)
++#define __noretpoline __attribute__((indirect_branch("keep")))
++#else
++#define __noretpoline
++#endif
++
+ /* These macros are used to mark some functions or
+ * initialized data (doesn't apply to uninitialized data)
+ * as `initialization' functions. The kernel can take this
+@@ -39,7 +46,7 @@
+
+ /* These are for everybody (although not all archs will actually
+ discard it in modules) */
+-#define __init __section(.init.text) __cold notrace
++#define __init __section(.init.text) __cold notrace __noretpoline
+ #define __initdata __section(.init.data)
+ #define __initconst __constsection(.init.rodata)
+ #define __exitdata __section(.exit.data)
--- /dev/null
+From foo@baz Fri Feb 23 17:23:58 CET 2018
+From: Jack Wang <jinpu.wang@profitbricks.com>
+Date: Fri, 23 Feb 2018 11:41:51 +0100
+Subject: x86/retpoline: Remove the esp/rsp thunk
+To: gregkh@linuxfoundation.org, stable@vger.kernel.org
+Cc: Waiman Long <longman@redhat.com>, Thomas Gleixner <tglx@linutronix.de>, Tom Lendacky <thomas.lendacky@amd.com>, Kees Cook <keescook@google.com>, Andi Kleen <ak@linux.intel.com>, Tim Chen <tim.c.chen@linux.intel.com>, Peter Zijlstra <peterz@infradead.org>, Linus Torvalds <torvalds@linux-foundation.org>, Jiri Kosina <jikos@kernel.org>, Andy Lutomirski <luto@amacapital.net>, Dave Hansen <dave.hansen@intel.com>, Josh Poimboeuf <jpoimboe@redhat.com>, Arjan van de Ven <arjan@linux.intel.com>, Greg Kroah-Hartman <gregkh@linux-foundation.org>, Paul Turner <pjt@google.com>, David Woodhouse <dwmw@amazon.co.uk>, Jack Wang <jinpu.wang@profitbricks.com>
+Message-ID: <1519382538-15143-3-git-send-email-jinpu.wangl@profitbricks.com>
+
+From: Waiman Long <longman@redhat.com>
+
+commit 1df37383a8aeabb9b418698f0bcdffea01f4b1b2 upstream.
+
+It doesn't make sense to have an indirect call thunk with esp/rsp as
+retpoline code won't work correctly with the stack pointer register.
+Removing it will help compiler writers to catch error in case such
+a thunk call is emitted incorrectly.
+
+Fixes: 76b043848fd2 ("x86/retpoline: Add initial retpoline support")
+Suggested-by: Jeff Law <law@redhat.com>
+Signed-off-by: Waiman Long <longman@redhat.com>
+Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
+Acked-by: David Woodhouse <dwmw@amazon.co.uk>
+Cc: Tom Lendacky <thomas.lendacky@amd.com>
+Cc: Kees Cook <keescook@google.com>
+Cc: Andi Kleen <ak@linux.intel.com>
+Cc: Tim Chen <tim.c.chen@linux.intel.com>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Jiri Kosina <jikos@kernel.org>
+Cc: Andy Lutomirski <luto@amacapital.net>
+Cc: Dave Hansen <dave.hansen@intel.com>
+Cc: Josh Poimboeuf <jpoimboe@redhat.com>
+Cc: Arjan van de Ven <arjan@linux.intel.com>
+Cc: Greg Kroah-Hartman <gregkh@linux-foundation.org>
+Cc: Paul Turner <pjt@google.com>
+Link: https://lkml.kernel.org/r/1516658974-27852-1-git-send-email-longman@redhat.com
+Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
+[jwang: cherry pick to 4.4]
+Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/x86/include/asm/asm-prototypes.h | 1 -
+ arch/x86/lib/retpoline.S | 1 -
+ 2 files changed, 2 deletions(-)
+
+--- a/arch/x86/include/asm/asm-prototypes.h
++++ b/arch/x86/include/asm/asm-prototypes.h
+@@ -37,5 +37,4 @@ INDIRECT_THUNK(dx)
+ INDIRECT_THUNK(si)
+ INDIRECT_THUNK(di)
+ INDIRECT_THUNK(bp)
+-INDIRECT_THUNK(sp)
+ #endif /* CONFIG_RETPOLINE */
+--- a/arch/x86/lib/retpoline.S
++++ b/arch/x86/lib/retpoline.S
+@@ -36,7 +36,6 @@ GENERATE_THUNK(_ASM_DX)
+ GENERATE_THUNK(_ASM_SI)
+ GENERATE_THUNK(_ASM_DI)
+ GENERATE_THUNK(_ASM_BP)
+-GENERATE_THUNK(_ASM_SP)
+ #ifdef CONFIG_64BIT
+ GENERATE_THUNK(r8)
+ GENERATE_THUNK(r9)
--- /dev/null
+From foo@baz Fri Feb 23 17:23:58 CET 2018
+From: Jack Wang <jinpu.wang@profitbricks.com>
+Date: Fri, 23 Feb 2018 11:41:58 +0100
+Subject: x86/spectre: Check CONFIG_RETPOLINE in command line parser
+To: gregkh@linuxfoundation.org, stable@vger.kernel.org
+Cc: Dou Liyang <douly.fnst@cn.fujitsu.com>, Thomas Gleixner <tglx@linutronix.de>, ak@linux.intel.com, peterz@infradead.org, Tomohiro <misono.tomohiro@jp.fujitsu.com>, dave.hansen@intel.com, bp@alien8.de, arjan@linux.intel.com, dwmw@amazon.co.uk, Jack Wang <jinpu.wang@profitbricks.com>
+Message-ID: <1519382538-15143-10-git-send-email-jinpu.wangl@profitbricks.com>
+
+From: Dou Liyang <douly.fnst@cn.fujitsu.com>
+
+(cherry picked from commit 9471eee9186a46893726e22ebb54cade3f9bc043)
+
+The spectre_v2 option 'auto' does not check whether CONFIG_RETPOLINE is
+enabled. As a consequence it fails to emit the appropriate warning and sets
+feature flags which have no effect at all.
+
+Add the missing IS_ENABLED() check.
+
+Fixes: da285121560e ("x86/spectre: Add boot time option to select Spectre v2 mitigation")
+Signed-off-by: Dou Liyang <douly.fnst@cn.fujitsu.com>
+Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
+Cc: ak@linux.intel.com
+Cc: peterz@infradead.org
+Cc: Tomohiro <misono.tomohiro@jp.fujitsu.com>
+Cc: dave.hansen@intel.com
+Cc: bp@alien8.de
+Cc: arjan@linux.intel.com
+Cc: dwmw@amazon.co.uk
+Cc: stable@vger.kernel.org
+Link: https://lkml.kernel.org/r/f5892721-7528-3647-08fb-f8d10e65ad87@cn.fujitsu.com
+Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
+[jwang: cherry-pick to 4.4]
+Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/x86/kernel/cpu/bugs.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+--- a/arch/x86/kernel/cpu/bugs.c
++++ b/arch/x86/kernel/cpu/bugs.c
+@@ -213,10 +213,10 @@ static void __init spectre_v2_select_mit
+ return;
+
+ case SPECTRE_V2_CMD_FORCE:
+- /* FALLTRHU */
+ case SPECTRE_V2_CMD_AUTO:
+- goto retpoline_auto;
+-
++ if (IS_ENABLED(CONFIG_RETPOLINE))
++ goto retpoline_auto;
++ break;
+ case SPECTRE_V2_CMD_RETPOLINE_AMD:
+ if (IS_ENABLED(CONFIG_RETPOLINE))
+ goto retpoline_amd;
--- /dev/null
+From foo@baz Fri Feb 23 17:23:58 CET 2018
+From: Jack Wang <jinpu.wang@profitbricks.com>
+Date: Fri, 23 Feb 2018 11:42:08 +0100
+Subject: x86/spectre: Fix spelling mistake: "vunerable"-> "vulnerable"
+To: gregkh@linuxfoundation.org, stable@vger.kernel.org
+Cc: Colin Ian King <colin.king@canonical.com>, Thomas Gleixner <tglx@linutronix.de>, Andi Kleen <ak@linux.intel.com>, kernel-janitors@vger.kernel.org, Andy Lutomirski <luto@kernel.org>, Borislav Petkov <bp@suse.de>, David Woodhouse <dwmw@amazon.co.uk>, Jack Wang <jinpu.wang@profitbricks.com>
+Message-ID: <1519382538-15143-20-git-send-email-jinpu.wangl@profitbricks.com>
+
+From: Colin Ian King <colin.king@canonical.com>
+
+(cherry picked from commit e698dcdfcda41efd0984de539767b4cddd235f1e)
+
+Trivial fix to spelling mistake in pr_err error message text.
+
+Signed-off-by: Colin Ian King <colin.king@canonical.com>
+Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
+Cc: Andi Kleen <ak@linux.intel.com>
+Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Cc: kernel-janitors@vger.kernel.org
+Cc: Andy Lutomirski <luto@kernel.org>
+Cc: Borislav Petkov <bp@suse.de>
+Cc: David Woodhouse <dwmw@amazon.co.uk>
+Link: https://lkml.kernel.org/r/20180130193218.9271-1-colin.king@canonical.com
+Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
+[jwang: cherry pick to 4.4]
+Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/x86/kernel/cpu/bugs.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/arch/x86/kernel/cpu/bugs.c
++++ b/arch/x86/kernel/cpu/bugs.c
+@@ -103,7 +103,7 @@ bool retpoline_module_ok(bool has_retpol
+ if (spectre_v2_enabled == SPECTRE_V2_NONE || has_retpoline)
+ return true;
+
+- pr_err("System may be vunerable to spectre v2\n");
++ pr_err("System may be vulnerable to spectre v2\n");
+ spectre_v2_bad_module = true;
+ return false;
+ }
--- /dev/null
+From foo@baz Fri Feb 23 17:23:58 CET 2018
+From: Jack Wang <jinpu.wang@profitbricks.com>
+Date: Fri, 23 Feb 2018 11:42:07 +0100
+Subject: x86/spectre: Report get_user mitigation for spectre_v1
+To: gregkh@linuxfoundation.org, stable@vger.kernel.org
+Cc: Dan Williams <dan.j.williams@intel.com>, Thomas Gleixner <tglx@linutronix.de>, linux-arch@vger.kernel.org, kernel-hardening@lists.openwall.com, torvalds@linux-foundation.org, alan@linux.intel.com, David Woodhouse <dwmw@amazon.co.uk>, Jack Wang <jinpu.wang@profitbricks.com>
+Message-ID: <1519382538-15143-19-git-send-email-jinpu.wangl@profitbricks.com>
+
+From: Dan Williams <dan.j.williams@intel.com>
+
+(cherry picked from commit edfbae53dab8348fca778531be9f4855d2ca0360)
+
+Reflect the presence of get_user(), __get_user(), and 'syscall' protections
+in sysfs. The expectation is that new and better tooling will allow the
+kernel to grow more usages of array_index_nospec(), for now, only claim
+mitigation for __user pointer de-references.
+
+Reported-by: Jiri Slaby <jslaby@suse.cz>
+Signed-off-by: Dan Williams <dan.j.williams@intel.com>
+Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
+Cc: linux-arch@vger.kernel.org
+Cc: kernel-hardening@lists.openwall.com
+Cc: gregkh@linuxfoundation.org
+Cc: torvalds@linux-foundation.org
+Cc: alan@linux.intel.com
+Link: https://lkml.kernel.org/r/151727420158.33451.11658324346540434635.stgit@dwillia2-desk3.amr.corp.intel.com
+Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
+[jwang: cherry pick to 4.4]
+Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/x86/kernel/cpu/bugs.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/arch/x86/kernel/cpu/bugs.c
++++ b/arch/x86/kernel/cpu/bugs.c
+@@ -291,7 +291,7 @@ ssize_t cpu_show_spectre_v1(struct devic
+ {
+ if (!boot_cpu_has_bug(X86_BUG_SPECTRE_V1))
+ return sprintf(buf, "Not affected\n");
+- return sprintf(buf, "Vulnerable\n");
++ return sprintf(buf, "Mitigation: __user pointer sanitization\n");
+ }
+
+ ssize_t cpu_show_spectre_v2(struct device *dev,
--- /dev/null
+From foo@baz Fri Feb 23 17:23:58 CET 2018
+From: Jack Wang <jinpu.wang@profitbricks.com>
+Date: Fri, 23 Feb 2018 11:42:12 +0100
+Subject: x86/spectre: Simplify spectre_v2 command line parsing
+To: gregkh@linuxfoundation.org, stable@vger.kernel.org
+Cc: KarimAllah Ahmed <karahmed@amazon.de>, David Woodhouse <dwmw@amazon.co.uk>, Thomas Gleixner <tglx@linutronix.de>, peterz@infradead.org, bp@alien8.de, Jack Wang <jinpu.wang@profitbricks.com>
+Message-ID: <1519382538-15143-24-git-send-email-jinpu.wangl@profitbricks.com>
+
+From: KarimAllah Ahmed <karahmed@amazon.de>
+
+(cherry picked from commit 9005c6834c0ffdfe46afa76656bd9276cca864f6)
+
+[dwmw2: Use ARRAY_SIZE]
+
+Signed-off-by: KarimAllah Ahmed <karahmed@amazon.de>
+Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
+Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
+Cc: peterz@infradead.org
+Cc: bp@alien8.de
+Link: https://lkml.kernel.org/r/1517484441-1420-3-git-send-email-dwmw@amazon.co.uk
+Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
+[jwang: cherry pick to 4.4]
+Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/x86/kernel/cpu/bugs.c | 84 +++++++++++++++++++++++++++++----------------
+ 1 file changed, 55 insertions(+), 29 deletions(-)
+
+--- a/arch/x86/kernel/cpu/bugs.c
++++ b/arch/x86/kernel/cpu/bugs.c
+@@ -119,13 +119,13 @@ static inline const char *spectre_v2_mod
+ static void __init spec2_print_if_insecure(const char *reason)
+ {
+ if (boot_cpu_has_bug(X86_BUG_SPECTRE_V2))
+- pr_info("%s\n", reason);
++ pr_info("%s selected on command line.\n", reason);
+ }
+
+ static void __init spec2_print_if_secure(const char *reason)
+ {
+ if (!boot_cpu_has_bug(X86_BUG_SPECTRE_V2))
+- pr_info("%s\n", reason);
++ pr_info("%s selected on command line.\n", reason);
+ }
+
+ static inline bool retp_compiler(void)
+@@ -140,42 +140,68 @@ static inline bool match_option(const ch
+ return len == arglen && !strncmp(arg, opt, len);
+ }
+
++static const struct {
++ const char *option;
++ enum spectre_v2_mitigation_cmd cmd;
++ bool secure;
++} mitigation_options[] = {
++ { "off", SPECTRE_V2_CMD_NONE, false },
++ { "on", SPECTRE_V2_CMD_FORCE, true },
++ { "retpoline", SPECTRE_V2_CMD_RETPOLINE, false },
++ { "retpoline,amd", SPECTRE_V2_CMD_RETPOLINE_AMD, false },
++ { "retpoline,generic", SPECTRE_V2_CMD_RETPOLINE_GENERIC, false },
++ { "auto", SPECTRE_V2_CMD_AUTO, false },
++};
++
+ static enum spectre_v2_mitigation_cmd __init spectre_v2_parse_cmdline(void)
+ {
+ char arg[20];
+- int ret;
++ int ret, i;
++ enum spectre_v2_mitigation_cmd cmd = SPECTRE_V2_CMD_AUTO;
++
++ if (cmdline_find_option_bool(boot_command_line, "nospectre_v2"))
++ return SPECTRE_V2_CMD_NONE;
++ else {
++ ret = cmdline_find_option(boot_command_line, "spectre_v2", arg,
++ sizeof(arg));
++ if (ret < 0)
++ return SPECTRE_V2_CMD_AUTO;
+
+- ret = cmdline_find_option(boot_command_line, "spectre_v2", arg,
+- sizeof(arg));
+- if (ret > 0) {
+- if (match_option(arg, ret, "off")) {
+- goto disable;
+- } else if (match_option(arg, ret, "on")) {
+- spec2_print_if_secure("force enabled on command line.");
+- return SPECTRE_V2_CMD_FORCE;
+- } else if (match_option(arg, ret, "retpoline")) {
+- spec2_print_if_insecure("retpoline selected on command line.");
+- return SPECTRE_V2_CMD_RETPOLINE;
+- } else if (match_option(arg, ret, "retpoline,amd")) {
+- if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD) {
+- pr_err("retpoline,amd selected but CPU is not AMD. Switching to AUTO select\n");
+- return SPECTRE_V2_CMD_AUTO;
+- }
+- spec2_print_if_insecure("AMD retpoline selected on command line.");
+- return SPECTRE_V2_CMD_RETPOLINE_AMD;
+- } else if (match_option(arg, ret, "retpoline,generic")) {
+- spec2_print_if_insecure("generic retpoline selected on command line.");
+- return SPECTRE_V2_CMD_RETPOLINE_GENERIC;
+- } else if (match_option(arg, ret, "auto")) {
++ for (i = 0; i < ARRAY_SIZE(mitigation_options); i++) {
++ if (!match_option(arg, ret, mitigation_options[i].option))
++ continue;
++ cmd = mitigation_options[i].cmd;
++ break;
++ }
++
++ if (i >= ARRAY_SIZE(mitigation_options)) {
++ pr_err("unknown option (%s). Switching to AUTO select\n",
++ mitigation_options[i].option);
+ return SPECTRE_V2_CMD_AUTO;
+ }
+ }
+
+- if (!cmdline_find_option_bool(boot_command_line, "nospectre_v2"))
++ if ((cmd == SPECTRE_V2_CMD_RETPOLINE ||
++ cmd == SPECTRE_V2_CMD_RETPOLINE_AMD ||
++ cmd == SPECTRE_V2_CMD_RETPOLINE_GENERIC) &&
++ !IS_ENABLED(CONFIG_RETPOLINE)) {
++ pr_err("%s selected but not compiled in. Switching to AUTO select\n",
++ mitigation_options[i].option);
+ return SPECTRE_V2_CMD_AUTO;
+-disable:
+- spec2_print_if_insecure("disabled on command line.");
+- return SPECTRE_V2_CMD_NONE;
++ }
++
++ if (cmd == SPECTRE_V2_CMD_RETPOLINE_AMD &&
++ boot_cpu_data.x86_vendor != X86_VENDOR_AMD) {
++ pr_err("retpoline,amd selected but CPU is not AMD. Switching to AUTO select\n");
++ return SPECTRE_V2_CMD_AUTO;
++ }
++
++ if (mitigation_options[i].secure)
++ spec2_print_if_secure(mitigation_options[i].option);
++ else
++ spec2_print_if_insecure(mitigation_options[i].option);
++
++ return cmd;
+ }
+
+ /* Check for Skylake-like CPUs (for RSB handling) */
--- /dev/null
+From foo@baz Fri Feb 23 17:23:58 CET 2018
+From: Jack Wang <jinpu.wang@profitbricks.com>
+Date: Fri, 23 Feb 2018 11:42:13 +0100
+Subject: x86/speculation: Fix typo IBRS_ATT, which should be IBRS_ALL
+To: gregkh@linuxfoundation.org, stable@vger.kernel.org
+Cc: Darren Kenny <darren.kenny@oracle.com>, Thomas Gleixner <tglx@linutronix.de>, Tom Lendacky <thomas.lendacky@amd.com>, Andi Kleen <ak@linux.intel.com>, Borislav Petkov <bp@alien8.de>, Masami Hiramatsu <mhiramat@kernel.org>, Arjan van de Ven <arjan@linux.intel.com>, David Woodhouse <dwmw@amazon.co.uk>, Jack Wang <jinpu.wang@profitbricks.com>
+Message-ID: <1519382538-15143-25-git-send-email-jinpu.wangl@profitbricks.com>
+
+From: Darren Kenny <darren.kenny@oracle.com>
+
+(cherry picked from commit af189c95a371b59f493dbe0f50c0a09724868881)
+
+Fixes: 117cc7a908c83 ("x86/retpoline: Fill return stack buffer on vmexit")
+Signed-off-by: Darren Kenny <darren.kenny@oracle.com>
+Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
+Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
+Cc: Tom Lendacky <thomas.lendacky@amd.com>
+Cc: Andi Kleen <ak@linux.intel.com>
+Cc: Borislav Petkov <bp@alien8.de>
+Cc: Masami Hiramatsu <mhiramat@kernel.org>
+Cc: Arjan van de Ven <arjan@linux.intel.com>
+Cc: David Woodhouse <dwmw@amazon.co.uk>
+Link: https://lkml.kernel.org/r/20180202191220.blvgkgutojecxr3b@starbug-vm.ie.oracle.com
+Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
+[jwang: cherry pick to 4.4]
+Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/x86/include/asm/nospec-branch.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/arch/x86/include/asm/nospec-branch.h
++++ b/arch/x86/include/asm/nospec-branch.h
+@@ -178,7 +178,7 @@ extern char __indirect_thunk_end[];
+ * On VMEXIT we must ensure that no RSB predictions learned in the guest
+ * can be followed in the host, by overwriting the RSB completely. Both
+ * retpoline and IBRS mitigations for Spectre v2 need this; only on future
+- * CPUs with IBRS_ATT *might* it be avoided.
++ * CPUs with IBRS_ALL *might* it be avoided.
+ */
+ static inline void vmexit_fill_RSB(void)
+ {
--- /dev/null
+From foo@baz Fri Feb 23 17:23:58 CET 2018
+From: Jack Wang <jinpu.wang@profitbricks.com>
+Date: Fri, 23 Feb 2018 11:42:04 +0100
+Subject: x86/syscall: Sanitize syscall table de-references under speculation
+To: gregkh@linuxfoundation.org, stable@vger.kernel.org
+Cc: Dan Williams <dan.j.williams@intel.com>, Thomas Gleixner <tglx@linutronix.de>, linux-arch@vger.kernel.org, kernel-hardening@lists.openwall.com, Andy Lutomirski <luto@kernel.org>, alan@linux.intel.com, David Woodhouse <dwmw@amazon.co.uk>, Jack Wang <jinpu.wang@profitbricks.com>
+Message-ID: <1519382538-15143-16-git-send-email-jinpu.wangl@profitbricks.com>
+
+From: Dan Williams <dan.j.williams@intel.com>
+
+(cherry picked from commit 2fbd7af5af8665d18bcefae3e9700be07e22b681)
+
+The syscall table base is a user controlled function pointer in kernel
+space. Use array_index_nospec() to prevent any out of bounds speculation.
+
+While retpoline prevents speculating into a userspace directed target it
+does not stop the pointer de-reference, the concern is leaking memory
+relative to the syscall table base, by observing instruction cache
+behavior.
+
+Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Dan Williams <dan.j.williams@intel.com>
+Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
+Cc: linux-arch@vger.kernel.org
+Cc: kernel-hardening@lists.openwall.com
+Cc: gregkh@linuxfoundation.org
+Cc: Andy Lutomirski <luto@kernel.org>
+Cc: alan@linux.intel.com
+Link: https://lkml.kernel.org/r/151727417984.33451.1216731042505722161.stgit@dwillia2-desk3.amr.corp.intel.com
+Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
+[jwang: port to 4.4, no syscall_64]
+Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/x86/entry/common.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/arch/x86/entry/common.c
++++ b/arch/x86/entry/common.c
+@@ -20,6 +20,7 @@
+ #include <linux/export.h>
+ #include <linux/context_tracking.h>
+ #include <linux/user-return-notifier.h>
++#include <linux/nospec.h>
+ #include <linux/uprobes.h>
+
+ #include <asm/desc.h>
+@@ -381,6 +382,7 @@ __always_inline void do_syscall_32_irqs_
+ }
+
+ if (likely(nr < IA32_NR_syscalls)) {
++ nr = array_index_nospec(nr, IA32_NR_syscalls);
+ /*
+ * It's possible that a 32-bit syscall implementation
+ * takes a 64-bit parameter but nonetheless assumes that