From: Greg Kroah-Hartman Date: Thu, 27 Apr 2017 14:31:22 +0000 (+0200) Subject: 4.4-stable patches X-Git-Tag: v4.4.65~10 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bbb3360bb2325d71724f41ba021532a736d43439;p=thirdparty%2Fkernel%2Fstable-queue.git 4.4-stable patches 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 --- 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 index 00000000000..c2c84be8d55 --- /dev/null +++ b/queue-4.4/gfs2-avoid-uninitialized-variable-warning.patch @@ -0,0 +1,51 @@ +From 67893f12e5374bbcaaffbc6e570acbc2714ea884 Mon Sep 17 00:00:00 2001 +From: Arnd Bergmann +Date: Tue, 26 Jan 2016 13:08:10 -0500 +Subject: gfs2: avoid uninitialized variable warning + +From: Arnd Bergmann + +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 +Signed-off-by: Bob Peterson +Signed-off-by: Greg Kroah-Hartman + +--- + 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 index 00000000000..650270fa34c --- /dev/null +++ b/queue-4.4/hostap-avoid-uninitialized-variable-use-in-hfa384x_get_rid.patch @@ -0,0 +1,69 @@ +From 48dc5fb3ba53b20418de8514700f63d88c5de3a3 Mon Sep 17 00:00:00 2001 +From: Arnd Bergmann +Date: Thu, 28 Jan 2016 22:58:28 +0100 +Subject: hostap: avoid uninitialized variable use in hfa384x_get_rid + +From: Arnd Bergmann + +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 +Signed-off-by: Kalle Valo +Signed-off-by: Greg Kroah-Hartman + +--- + 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); + diff --git a/queue-4.4/series b/queue-4.4/series index ced80b217a8..d01c9699930 100644 --- a/queue-4.4/series +++ b/queue-4.4/series @@ -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 index 00000000000..4df0ddc4555 --- /dev/null +++ b/queue-4.4/tty-nozomi-avoid-a-harmless-gcc-warning.patch @@ -0,0 +1,56 @@ +From a4f642a8a3c2838ad09fe8313d45db46600e1478 Mon Sep 17 00:00:00 2001 +From: Arnd Bergmann +Date: Mon, 25 Jan 2016 22:54:56 +0100 +Subject: tty: nozomi: avoid a harmless gcc warning + +From: Arnd Bergmann + +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 +Signed-off-by: Greg Kroah-Hartman + +--- + 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)) {