]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.4-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 27 Apr 2017 14:31:22 +0000 (16:31 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 27 Apr 2017 14:31:22 +0000 (16:31 +0200)
added patches:
gfs2-avoid-uninitialized-variable-warning.patch
hostap-avoid-uninitialized-variable-use-in-hfa384x_get_rid.patch
tty-nozomi-avoid-a-harmless-gcc-warning.patch

queue-4.4/gfs2-avoid-uninitialized-variable-warning.patch [new file with mode: 0644]
queue-4.4/hostap-avoid-uninitialized-variable-use-in-hfa384x_get_rid.patch [new file with mode: 0644]
queue-4.4/series
queue-4.4/tty-nozomi-avoid-a-harmless-gcc-warning.patch [new file with mode: 0644]

diff --git a/queue-4.4/gfs2-avoid-uninitialized-variable-warning.patch b/queue-4.4/gfs2-avoid-uninitialized-variable-warning.patch
new file mode 100644 (file)
index 0000000..c2c84be
--- /dev/null
@@ -0,0 +1,51 @@
+From 67893f12e5374bbcaaffbc6e570acbc2714ea884 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Tue, 26 Jan 2016 13:08:10 -0500
+Subject: gfs2: avoid uninitialized variable warning
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit 67893f12e5374bbcaaffbc6e570acbc2714ea884 upstream.
+
+We get a bogus warning about a potential uninitialized variable
+use in gfs2, because the compiler does not figure out that we
+never use the leaf number if get_leaf_nr() returns an error:
+
+fs/gfs2/dir.c: In function 'get_first_leaf':
+fs/gfs2/dir.c:802:9: warning: 'leaf_no' may be used uninitialized in this function [-Wmaybe-uninitialized]
+fs/gfs2/dir.c: In function 'dir_split_leaf':
+fs/gfs2/dir.c:1021:8: warning: 'leaf_no' may be used uninitialized in this function [-Wmaybe-uninitialized]
+
+Changing the 'if (!error)' to 'if (!IS_ERR_VALUE(error))' is
+sufficient to let gcc understand that this is exactly the same
+condition as in IS_ERR() so it can optimize the code path enough
+to understand it.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Bob Peterson <rpeterso@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/gfs2/dir.c |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/fs/gfs2/dir.c
++++ b/fs/gfs2/dir.c
+@@ -760,7 +760,7 @@ static int get_first_leaf(struct gfs2_in
+       int error;
+       error = get_leaf_nr(dip, index, &leaf_no);
+-      if (!error)
++      if (!IS_ERR_VALUE(error))
+               error = get_leaf(dip, leaf_no, bh_out);
+       return error;
+@@ -976,7 +976,7 @@ static int dir_split_leaf(struct inode *
+       index = name->hash >> (32 - dip->i_depth);
+       error = get_leaf_nr(dip, index, &leaf_no);
+-      if (error)
++      if (IS_ERR_VALUE(error))
+               return error;
+       /*  Get the old leaf block  */
diff --git a/queue-4.4/hostap-avoid-uninitialized-variable-use-in-hfa384x_get_rid.patch b/queue-4.4/hostap-avoid-uninitialized-variable-use-in-hfa384x_get_rid.patch
new file mode 100644 (file)
index 0000000..650270f
--- /dev/null
@@ -0,0 +1,69 @@
+From 48dc5fb3ba53b20418de8514700f63d88c5de3a3 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Thu, 28 Jan 2016 22:58:28 +0100
+Subject: hostap: avoid uninitialized variable use in hfa384x_get_rid
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit 48dc5fb3ba53b20418de8514700f63d88c5de3a3 upstream.
+
+The driver reads a value from hfa384x_from_bap(), which may fail,
+and then assigns the value to a local variable. gcc detects that
+in in the failure case, the 'rlen' variable now contains
+uninitialized data:
+
+In file included from ../drivers/net/wireless/intersil/hostap/hostap_pci.c:220:0:
+drivers/net/wireless/intersil/hostap/hostap_hw.c: In function 'hfa384x_get_rid':
+drivers/net/wireless/intersil/hostap/hostap_hw.c:842:5: warning: 'rec' may be used uninitialized in this function [-Wmaybe-uninitialized]
+  if (le16_to_cpu(rec.len) == 0) {
+
+This restructures the function as suggested by Russell King, to
+make it more readable and get more reliable error handling, by
+handling each failure mode using a goto.
+
+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/hostap/hostap_hw.c |   15 ++++++++++-----
+ 1 file changed, 10 insertions(+), 5 deletions(-)
+
+--- a/drivers/net/wireless/hostap/hostap_hw.c
++++ b/drivers/net/wireless/hostap/hostap_hw.c
+@@ -836,25 +836,30 @@ static int hfa384x_get_rid(struct net_de
+       spin_lock_bh(&local->baplock);
+       res = hfa384x_setup_bap(dev, BAP0, rid, 0);
+-      if (!res)
+-              res = hfa384x_from_bap(dev, BAP0, &rec, sizeof(rec));
++      if (res)
++              goto unlock;
++
++      res = hfa384x_from_bap(dev, BAP0, &rec, sizeof(rec));
++      if (res)
++              goto unlock;
+       if (le16_to_cpu(rec.len) == 0) {
+               /* RID not available */
+               res = -ENODATA;
++              goto unlock;
+       }
+       rlen = (le16_to_cpu(rec.len) - 1) * 2;
+-      if (!res && exact_len && rlen != len) {
++      if (exact_len && rlen != len) {
+               printk(KERN_DEBUG "%s: hfa384x_get_rid - RID len mismatch: "
+                      "rid=0x%04x, len=%d (expected %d)\n",
+                      dev->name, rid, rlen, len);
+               res = -ENODATA;
+       }
+-      if (!res)
+-              res = hfa384x_from_bap(dev, BAP0, buf, len);
++      res = hfa384x_from_bap(dev, BAP0, buf, len);
++unlock:
+       spin_unlock_bh(&local->baplock);
+       mutex_unlock(&local->rid_bap_mtx);
index ced80b217a8dbedcfeda5ddbdf284e074513d3f0..d01c9699930db6b4c9cec551f8fbae3e67b62412 100644 (file)
@@ -2,3 +2,6 @@ tipc-make-sure-ipv6-header-fits-in-skb-headroom.patch
 tipc-make-dist-queue-pernet.patch
 tipc-re-enable-compensation-for-socket-receive-buffer-double-counting.patch
 tipc-correct-error-in-node-fsm.patch
+tty-nozomi-avoid-a-harmless-gcc-warning.patch
+hostap-avoid-uninitialized-variable-use-in-hfa384x_get_rid.patch
+gfs2-avoid-uninitialized-variable-warning.patch
diff --git a/queue-4.4/tty-nozomi-avoid-a-harmless-gcc-warning.patch b/queue-4.4/tty-nozomi-avoid-a-harmless-gcc-warning.patch
new file mode 100644 (file)
index 0000000..4df0ddc
--- /dev/null
@@ -0,0 +1,56 @@
+From a4f642a8a3c2838ad09fe8313d45db46600e1478 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Mon, 25 Jan 2016 22:54:56 +0100
+Subject: tty: nozomi: avoid a harmless gcc warning
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit a4f642a8a3c2838ad09fe8313d45db46600e1478 upstream.
+
+The nozomi wireless data driver has its own helper function to
+transfer data from a FIFO, doing an extra byte swap on big-endian
+architectures, presumably to bring the data back into byte-serial
+order after readw() or readl() perform their implicit byteswap.
+
+This helper function is used in the receive_data() function to
+first read the length into a 32-bit variable, which causes
+a compile-time warning:
+
+drivers/tty/nozomi.c: In function 'receive_data':
+drivers/tty/nozomi.c:857:9: warning: 'size' may be used uninitialized in this function [-Wmaybe-uninitialized]
+
+The problem is that gcc is unsure whether the data was actually
+read or not. We know that it is at this point, so we can replace
+it with a single readl() to shut up that warning.
+
+I am leaving the byteswap in there, to preserve the existing
+behavior, even though this seems fishy: Reading the length of
+the data into a cpu-endian variable should normally not use
+a second byteswap on big-endian systems, unless the hardware
+is aware of the CPU endianess.
+
+There appears to be a lot more confusion about endianess in this
+driver, so it probably has not worked on big-endian systems in
+a long time, if ever, and I have no way to test it. It's well
+possible that this driver has not been used by anyone in a while,
+the last patch that looks like it was tested on the hardware is
+from 2008.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/tty/nozomi.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/tty/nozomi.c
++++ b/drivers/tty/nozomi.c
+@@ -823,7 +823,7 @@ static int receive_data(enum port_type i
+       struct tty_struct *tty = tty_port_tty_get(&port->port);
+       int i, ret;
+-      read_mem32((u32 *) &size, addr, 4);
++      size = __le32_to_cpu(readl(addr));
+       /*  DBG1( "%d bytes port: %d", size, index); */
+       if (tty && test_bit(TTY_THROTTLED, &tty->flags)) {