This is a note to let you know that I've just added the patch titled shmem: avoid maybe-uninitialized warning to the 4.9-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: shmem-avoid-maybe-uninitialized-warning.patch and it can be found in the queue-4.9 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 23f919d4ad0eb325595f10f55be4301b2965d6d6 Mon Sep 17 00:00:00 2001 From: Arnd Bergmann <arnd@xxxxxxxx> Date: Mon, 12 Dec 2016 16:42:28 -0800 Subject: shmem: avoid maybe-uninitialized warning From: Arnd Bergmann <arnd@xxxxxxxx> commit 23f919d4ad0eb325595f10f55be4301b2965d6d6 upstream. After enabling -Wmaybe-uninitialized warnings, we get a false-postive warning for shmem: mm/shmem.c: In function `shmem_getpage_gfp': include/linux/spinlock.h:332:21: error: `info' may be used uninitialized in this function [-Werror=maybe-uninitialized] This can be easily avoided, since the correct 'info' pointer is known at the time we first enter the function, so we can simply move the initialization up. Moving it before the first label avoids the warning and lets us remove two later initializations. Note that the function is so hard to read that it not only confuses the compiler, but also most readers and without this patch it could\ easily break if one of the 'goto's changed. Link: https://www.spinics.net/lists/kernel/msg2368133.html Link: http://lkml.kernel.org/r/20161024205725.786455-1-arnd@xxxxxxxx Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx> Acked-by: Michal Hocko <mhocko@xxxxxxxx> Acked-by: Kirill A. Shutemov <kirill.shutemov@xxxxxxxxxxxxxxx> Acked-by: Vlastimil Babka <vbabka@xxxxxxx> Cc: Hugh Dickins <hughd@xxxxxxxxxx> Cc: Andreas Gruenbacher <agruenba@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> Signed-off-by: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- mm/shmem.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) --- a/mm/shmem.c +++ b/mm/shmem.c @@ -1550,7 +1550,7 @@ static int shmem_getpage_gfp(struct inod struct mm_struct *fault_mm, int *fault_type) { struct address_space *mapping = inode->i_mapping; - struct shmem_inode_info *info; + struct shmem_inode_info *info = SHMEM_I(inode); struct shmem_sb_info *sbinfo; struct mm_struct *charge_mm; struct mem_cgroup *memcg; @@ -1600,7 +1600,6 @@ repeat: * Fast cache lookup did not find it: * bring it back from swap or allocate. */ - info = SHMEM_I(inode); sbinfo = SHMEM_SB(inode->i_sb); charge_mm = fault_mm ? : current->mm; @@ -1852,7 +1851,6 @@ unlock: put_page(page); } if (error == -ENOSPC && !once++) { - info = SHMEM_I(inode); spin_lock_irq(&info->lock); shmem_recalc_inode(inode); spin_unlock_irq(&info->lock); Patches currently in stable-queue which might be from arnd@xxxxxxxx are queue-4.9/kasan-rework-kconfig-settings.patch queue-4.9/tw5864-use-dev_warn-instead-of-warn-to-shut-up-warning.patch queue-4.9/perf-x86-shut-up-false-positive-wmaybe-uninitialized-warning.patch queue-4.9/go7007-add-media_camera_support-dependency.patch queue-4.9/scsi-advansys-fix-build-warning-for-pci-n.patch queue-4.9/video-fbdev-via-remove-possibly-unused-variables.patch queue-4.9/drm-exynos-mark-pm-functions-as-__maybe_unused.patch queue-4.9/binfmt_elf-compat-avoid-unused-function-warning.patch queue-4.9/idle-i7300-add-pci-dependency.patch queue-4.9/cw1200-fix-bogus-maybe-uninitialized-warning.patch queue-4.9/x86-build-silence-the-build-with-make-s.patch queue-4.9/gpio-xgene-mark-pm-functions-as-__maybe_unused.patch queue-4.9/kvm-add-x86_local_apic-dependency.patch queue-4.9/reiserfs-avoid-a-wmaybe-uninitialized-warning.patch queue-4.9/scsi-advansys-fix-uninitialized-data-access.patch queue-4.9/drm-i915-fix-intel_backlight_device_register-declaration.patch queue-4.9/spi-bcm-qspi-shut-up-warning-about-cfi-header-inclusion.patch queue-4.9/asoc-ux500-add-module_license-tag.patch queue-4.9/x86-microcode-amd-change-load_microcode_amd-s-param-to-bool-to-fix-preemptibility-bug.patch queue-4.9/video-fbdev-mmp-add-module_license.patch queue-4.9/usb-phy-msm-add-regulator-dependency.patch queue-4.9/arm64-dts-add-cooling-cells-to-cpu-nodes.patch queue-4.9/vmxnet3-prevent-building-with-64k-pages.patch queue-4.9/x86-platform-add-pci-dependency-for-punit_atom_debug.patch queue-4.9/alsa-hda-ca0132-fix-possible-null-pointer-use.patch queue-4.9/thermal-fix-intel_soc_dts_iosf_core-dependencies.patch queue-4.9/arm64-define-bug-instruction-without-config_bug.patch queue-4.9/arm64-sunxi-always-enable-reset-controller.patch queue-4.9/tc358743-fix-register-i2c_rd-wr-functions.patch queue-4.9/security-keys-big_key-requires-config_crypto.patch queue-4.9/drm-i915-hide-unused-intel_panel_set_backlight-function.patch queue-4.9/x86-fpu-math-emu-fix-possible-uninitialized-variable-use.patch queue-4.9/arm-8743-1-bl_switcher-add-module_license-tag.patch queue-4.9/em28xx-only-use-mt9v011-if-camera-support-is-enabled.patch queue-4.9/arm64-fix-warning-about-swapper_pg_dir-overflow.patch queue-4.9/shmem-avoid-maybe-uninitialized-warning.patch queue-4.9/input-tca8418_keypad-hide-gcc-4.9-wmaybe-uninitialized-warning.patch queue-4.9/drm-nouveau-hide-gcc-4.9-wmaybe-uninitialized.patch queue-4.9/x86-add-multiuser-dependency-for-kvm.patch queue-4.9/isdn-eicon-reduce-stack-size-of-sig_ind-function.patch