This is a note to let you know that I've just added the patch titled gfs2: remove IS_ERR_VALUE abuse to the 3.18-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: gfs2-remove-is_err_value-abuse.patch and it can be found in the queue-3.18 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From arnd@xxxxxxxx Fri May 5 10:45:31 2017 From: Arnd Bergmann <arnd@xxxxxxxx> Date: Fri, 5 May 2017 13:57:25 +0200 Subject: gfs2: remove IS_ERR_VALUE abuse To: gregkh@xxxxxxxxxxxxxxxxxxx Cc: stable@xxxxxxxxxxxxxxx, Arnd Bergmann <arnd@xxxxxxxx> Message-ID: <20170505115725.1424772-10-arnd@xxxxxxxx> From: Arnd Bergmann <arnd@xxxxxxxx> Picked from commit 287980e49ffc0f6d911601e7e352a812ed27768e ("remove lots of IS_ERR_VALUE abuses") upstream. The original fix that was backported to 3.18 already addressed the warning in some configurations, but not in others, leaving us with the same output: ../fs/gfs2/dir.c: In function 'get_first_leaf': ../fs/gfs2/dir.c:768:9: warning: 'leaf_no' may be used uninitialized in this function [-Wmaybe-uninitialized] error = get_leaf(dip, leaf_no, bh_out); ^ ../fs/gfs2/dir.c: In function 'dir_split_leaf.isra.20': ../fs/gfs2/dir.c:987:8: warning: 'leaf_no' may be used uninitialized in this function [-Wmaybe-uninitialized] This takes the approach that we took in later versions in mainline, but does not backport the entire patch, as that would be too large for stable and IIRC caused regressions in other drivers. Fixes: 9d46d31e9aea ("gfs2: avoid uninitialized variable warning") Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- fs/gfs2/dir.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) --- a/fs/gfs2/dir.c +++ b/fs/gfs2/dir.c @@ -749,12 +749,15 @@ static int get_leaf_nr(struct gfs2_inode u64 *leaf_out) { __be64 *hash; + int error; hash = gfs2_dir_get_hash_table(dip); - if (IS_ERR(hash)) - return PTR_ERR(hash); - *leaf_out = be64_to_cpu(*(hash + index)); - return 0; + error = PTR_ERR_OR_ZERO(hash); + + if (!error) + *leaf_out = be64_to_cpu(*(hash + index)); + + return error; } static int get_first_leaf(struct gfs2_inode *dip, u32 index, @@ -764,7 +767,7 @@ static int get_first_leaf(struct gfs2_in int error; error = get_leaf_nr(dip, index, &leaf_no); - if (!IS_ERR_VALUE(error)) + if (!error) error = get_leaf(dip, leaf_no, bh_out); return error; @@ -980,7 +983,7 @@ static int dir_split_leaf(struct inode * index = name->hash >> (32 - dip->i_depth); error = get_leaf_nr(dip, index, &leaf_no); - if (IS_ERR_VALUE(error)) + if (error) return error; /* Get the old leaf block */ Patches currently in stable-queue which might be from arnd@xxxxxxxx are queue-3.18/ib-iser-fix-sparse-warnings.patch queue-3.18/cred-userns-define-current_user_ns-as-a-function.patch queue-3.18/mips-elf2ecoff-ignore-pt_mips_abiflags-program-headers.patch queue-3.18/pci-xilinx-fix-harmless-format-string-warning.patch queue-3.18/arm64-build-vdso-without-libgcov.patch queue-3.18/arm64-provide-a-namespace-to-ncaps.patch queue-3.18/alsa-ppc-awacs-shut-up-maybe-uninitialized-warning.patch queue-3.18/mips-jz4740-fix-build-error-in-irq.h.patch queue-3.18/modpost-don-t-emit-section-mismatch-warnings-for-compiler-optimizations.patch queue-3.18/net-tg3-avoid-uninitialized-variable-warning.patch queue-3.18/tty-isicom-fix-big-endian-compile-warning.patch queue-3.18/mtd-avoid-stack-overflow-in-mtd-cfi-code.patch queue-3.18/cpumask_set_cpu_local_first-cpumask_local_spread-lament.patch queue-3.18/ib-qib-rename-bits_per_page-to-rvt_bits_per_page.patch queue-3.18/modpost-expand-pattern-matching-to-support-substring-matches.patch queue-3.18/ips-remove-pointless-warning.patch queue-3.18/powerpc-ptrace-fix-out-of-bounds-array-access-warning.patch queue-3.18/scsi-advansys-remove-warning-message.patch queue-3.18/staging-imx-drm-fix-indentation-warning.patch queue-3.18/mlx5-avoid-build-warnings-on-32-bit.patch queue-3.18/mm-cma-silence-warnings-due-to-max-usage.patch queue-3.18/misdn-avoid-arch-specific-__builtin_return_address-call.patch queue-3.18/staging-bcm-add-32-bit-host-dependency.patch queue-3.18/e1000e-fix-call-to-do_div-to-use-u64-arg.patch queue-3.18/gfs2-remove-is_err_value-abuse.patch queue-3.18/message-i2o-fix-64bit-build-warnings.patch queue-3.18/staging-vt6655-fix-overly-large-stack-usage.patch queue-3.18/drbd-avoid-redefinition-of-bits_per_page.patch queue-3.18/infiniband-mlx5-avoid-a-compile-time-warning.patch queue-3.18/kbuild-mergeconfig-fix-jobserver-unavailable-warning.patch queue-3.18/arm-cns3xxx-shut-up-frame-size-warning.patch queue-3.18/ib-ehca-fix-maybe-uninitialized-warnings.patch queue-3.18/mips-elf2ecoff-fix-warning-due-to-dead-code.patch queue-3.18/staging-unisys-correctly-handle-return-value-from-queue_delayed_work.patch