Skip to contentSkip to conversation

Patch "lz4: fix bogus gcc warning" has been added to the 4.9-stable tree

PATCH [email protected] 1 participant 1 message Aug 31, 2017 Stable branch

lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

lz4: fix bogus gcc 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:
lz4-fix-bogus-gcc-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 <[email protected]> know about it.

Quoted 1 line

From foo@baz Thu Aug 31 09:09:54 CEST 2017

Date: Thu, 31 Aug 2017 09:09:54 +0200
To: Greg KH <[email protected]>
From: Greg Kroah-Hartman <[email protected]>
Subject: lz4: fix bogus gcc warning

From: Greg Kroah-Hartman <[email protected]>

When building lz4 under gcc-7 we get the following bogus warning:

CC [M] lib/lz4/lz4hc_compress.o
lib/lz4/lz4hc_compress.c: In function ‘lz4hc_compress’:
lib/lz4/lz4hc_compress.c:179:42: warning: ‘delta’ may be used uninitialized in this function [-Wmaybe-uninitialized]

    chaintable[(size_t)(ptr) & MAXD_MASK] = delta;
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
lib/lz4/lz4hc_compress.c:134:6: note: ‘delta’ was declared here
  u16 delta;
      ^~~~~

This doesn't show up in the 4.4-stable tree due to us turning off warnings like this. It also doesn't show up in newer kernel versions as this code was totally rewritten.

So for now, to get the 4.9-stable tree to build with 0 warnings on x86 allmodconfig, let's just shut the compiler up by initializing the variable to 0, despite it not really doing anything.

To be far, this code is crazy complex, so the fact that gcc can't determine if the variable is really used or not isn't that bad, I'd blame the code here instead of the compiler.

---
 lib/lz4/lz4hc_compress.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/lz4/lz4hc_compress.c +1 -1
@@ -131,7 +131,7 @@ static inline int lz4hc_insertandfindbes
 #endif
 	int nbattempts = MAX_NB_ATTEMPTS;
 	size_t repl = 0, ml = 0;
-	u16 delta;
+	u16 delta = 0;
 
 	/* HC4 match finder */
 	lz4hc_insert(hc4, ip);

Patches currently in stable-queue which might be from [email protected] are

queue-4.9/scsi-sg-protect-accesses-to-reserved-page-array.patch queue-4.9/locking-spinlock-debug-remove-spinlock-lockup-detection-code.patch queue-4.9/p54-memset-0-whole-array.patch queue-4.9/lz4-fix-bogus-gcc-warning.patch queue-4.9/x86-io-add-memory-clobber-to-insb-insw-insl-outsb-outsw-outsl.patch queue-4.9/gcov-support-gcc-7.1.patch queue-4.9/staging-wilc1000-simplify-vif-ndev-accesses.patch queue-4.9/arm64-fpsimd-prevent-registers-leaking-across-exec.patch queue-4.9/scsi-isci-avoid-array-subscript-warning.patch queue-4.9/arm64-mm-abort-uaccess-retries-upon-fatal-signal.patch queue-4.9/kvm-arm-arm64-fix-race-in-resetting-stage2-pgd.patch queue-4.9/scsi-sg-reset-res_in_use-after-unlinking-reserved-array.patch