From cd8e7d1bd253cde1464bd3757893ee3e8d61f2b8 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Thu, 5 Oct 2017 11:16:22 +0200 Subject: [PATCH] 3.18-stable patches added patches: alsa-au88x0-avoid-theoretical-uninitialized-access.patch ib-qib-fix-false-postive-maybe-uninitialized-warning.patch staging-nvec-remove-duplicated-const.patch ttpci-address-stringop-overflow-warning.patch --- ...oid-theoretical-uninitialized-access.patch | 40 ++++++ ...-postive-maybe-uninitialized-warning.patch | 39 ++++++ queue-3.18/series | 4 + ...staging-nvec-remove-duplicated-const.patch | 34 ++++++ ...ci-address-stringop-overflow-warning.patch | 115 ++++++++++++++++++ queue-4.13/series | 1 + 6 files changed, 233 insertions(+) create mode 100644 queue-3.18/alsa-au88x0-avoid-theoretical-uninitialized-access.patch create mode 100644 queue-3.18/ib-qib-fix-false-postive-maybe-uninitialized-warning.patch create mode 100644 queue-3.18/staging-nvec-remove-duplicated-const.patch create mode 100644 queue-3.18/ttpci-address-stringop-overflow-warning.patch create mode 100644 queue-4.13/series diff --git a/queue-3.18/alsa-au88x0-avoid-theoretical-uninitialized-access.patch b/queue-3.18/alsa-au88x0-avoid-theoretical-uninitialized-access.patch new file mode 100644 index 00000000000..26fee1d8d6f --- /dev/null +++ b/queue-3.18/alsa-au88x0-avoid-theoretical-uninitialized-access.patch @@ -0,0 +1,40 @@ +From 13f99ebdd602ebdafb909e15ec6ffb1e34690167 Mon Sep 17 00:00:00 2001 +From: Arnd Bergmann +Date: Thu, 23 Mar 2017 16:15:55 +0100 +Subject: ALSA: au88x0: avoid theoretical uninitialized access + +From: Arnd Bergmann + +commit 13f99ebdd602ebdafb909e15ec6ffb1e34690167 upstream. + +The latest gcc-7.0.1 snapshot points out that we if nr_ch is zero, we never +initialize some variables: + +sound/pci/au88x0/au88x0_core.c: In function 'vortex_adb_allocroute': +sound/pci/au88x0/au88x0_core.c:2304:68: error: 'mix[0]' may be used uninitialized in this function [-Werror=maybe-uninitialized] +sound/pci/au88x0/au88x0_core.c:2305:58: error: 'src[0]' may be used uninitialized in this function [-Werror=maybe-uninitialized] + +I assume this can never happen in practice, but adding a check here doesn't +hurt either and avoids the warning. The code has been unchanged since +the start of git history. + +Signed-off-by: Arnd Bergmann +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman + +--- + sound/pci/au88x0/au88x0_core.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/sound/pci/au88x0/au88x0_core.c ++++ b/sound/pci/au88x0/au88x0_core.c +@@ -2273,6 +2273,9 @@ vortex_adb_allocroute(vortex_t *vortex, + } else { + int src[2], mix[2]; + ++ if (nr_ch < 1) ++ return -EINVAL; ++ + /* Get SRC and MIXER hardware resources. */ + for (i = 0; i < nr_ch; i++) { + if ((mix[i] = diff --git a/queue-3.18/ib-qib-fix-false-postive-maybe-uninitialized-warning.patch b/queue-3.18/ib-qib-fix-false-postive-maybe-uninitialized-warning.patch new file mode 100644 index 00000000000..8d568a05ada --- /dev/null +++ b/queue-3.18/ib-qib-fix-false-postive-maybe-uninitialized-warning.patch @@ -0,0 +1,39 @@ +From f6aafac184a3e46e919769dd4faa8bf0dc436534 Mon Sep 17 00:00:00 2001 +From: Arnd Bergmann +Date: Tue, 14 Mar 2017 13:18:45 +0100 +Subject: IB/qib: fix false-postive maybe-uninitialized warning + +From: Arnd Bergmann + +commit f6aafac184a3e46e919769dd4faa8bf0dc436534 upstream. + +aarch64-linux-gcc-7 complains about code it doesn't fully understand: + +drivers/infiniband/hw/qib/qib_iba7322.c: In function 'qib_7322_txchk_change': +include/asm-generic/bitops/non-atomic.h:105:35: error: 'shadow' may be used uninitialized in this function [-Werror=maybe-uninitialized] + +The code is right, and despite trying hard, I could not come up with a version +that I liked better than just adding a fake initialization here to shut up the +warning. + +Fixes: f931551bafe1 ("IB/qib: Add new qib driver for QLogic PCIe InfiniBand adapters") +Signed-off-by: Arnd Bergmann +Acked-by: Ira Weiny +Signed-off-by: Doug Ledford +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/infiniband/hw/qib/qib_iba7322.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/infiniband/hw/qib/qib_iba7322.c ++++ b/drivers/infiniband/hw/qib/qib_iba7322.c +@@ -7078,7 +7078,7 @@ static void qib_7322_txchk_change(struct + unsigned long flags; + + while (wait) { +- unsigned long shadow; ++ unsigned long shadow = 0; + int cstart, previ = -1; + + /* diff --git a/queue-3.18/series b/queue-3.18/series index aa8d12868de..a7169a1155a 100644 --- a/queue-3.18/series +++ b/queue-3.18/series @@ -27,3 +27,7 @@ rds-ib-add-error-handle.patch md-raid10-submit-bio-directly-to-replacement-disk.patch xfs-remove-kmem_zalloc_greedy.patch libata-transport-remove-circular-dependency-at-free-time.patch +ib-qib-fix-false-postive-maybe-uninitialized-warning.patch +alsa-au88x0-avoid-theoretical-uninitialized-access.patch +ttpci-address-stringop-overflow-warning.patch +staging-nvec-remove-duplicated-const.patch diff --git a/queue-3.18/staging-nvec-remove-duplicated-const.patch b/queue-3.18/staging-nvec-remove-duplicated-const.patch new file mode 100644 index 00000000000..e94a08b2eb6 --- /dev/null +++ b/queue-3.18/staging-nvec-remove-duplicated-const.patch @@ -0,0 +1,34 @@ +From 716baa7b430c66187a41e4d41eedf5de01343b21 Mon Sep 17 00:00:00 2001 +From: Peng Fan +Date: Tue, 16 Jun 2015 23:13:21 +0800 +Subject: staging: nvec: remove duplicated const + +From: Peng Fan + +commit 716baa7b430c66187a41e4d41eedf5de01343b21 upstream. + +Sparse checking warning: +"drivers/staging/nvec/nvec_ps2.c:172:14: warning: duplicate const". +Remove the duplicated const to fix the warning. + +Signed-off-by: Peng Fan +Acked-by: Marc Dietrich +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/staging/nvec/nvec_ps2.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/staging/nvec/nvec_ps2.c ++++ b/drivers/staging/nvec/nvec_ps2.c +@@ -165,8 +165,8 @@ static int nvec_mouse_resume(struct devi + } + #endif + +-static const SIMPLE_DEV_PM_OPS(nvec_mouse_pm_ops, nvec_mouse_suspend, +- nvec_mouse_resume); ++static SIMPLE_DEV_PM_OPS(nvec_mouse_pm_ops, nvec_mouse_suspend, ++ nvec_mouse_resume); + + static struct platform_driver nvec_mouse_driver = { + .probe = nvec_mouse_probe, diff --git a/queue-3.18/ttpci-address-stringop-overflow-warning.patch b/queue-3.18/ttpci-address-stringop-overflow-warning.patch new file mode 100644 index 00000000000..07a08588a50 --- /dev/null +++ b/queue-3.18/ttpci-address-stringop-overflow-warning.patch @@ -0,0 +1,115 @@ +From 69d3973af1acd4c0989ec8218c05f12d303cd7cf Mon Sep 17 00:00:00 2001 +From: Arnd Bergmann +Date: Thu, 2 Feb 2017 12:51:28 -0200 +Subject: [media] ttpci: address stringop overflow warning + +From: Arnd Bergmann + +commit 69d3973af1acd4c0989ec8218c05f12d303cd7cf upstream. + +gcc-7.0.1 warns about old code in ttpci: + +In file included from drivers/media/pci/ttpci/av7110.c:63:0: +In function 'irdebi.isra.2', + inlined from 'start_debi_dma' at drivers/media/pci/ttpci/av7110.c:376:3, + inlined from 'gpioirq' at drivers/media/pci/ttpci/av7110.c:659:3: +drivers/media/pci/ttpci/av7110_hw.h:406:3: warning: 'memcpy': specified size between 18446744071562067968 and 18446744073709551615 exceeds maximum object size 9223372036854775807 [-Wstringop-overflow=] + memcpy(av7110->debi_virt, (char *) &res, count); +In function 'irdebi.isra.2', + inlined from 'start_debi_dma' at drivers/media/pci/ttpci/av7110.c:376:3, + inlined from 'gpioirq' at drivers/media/pci/ttpci/av7110.c:668:3: +drivers/media/pci/ttpci/av7110_hw.h:406:3: warning: 'memcpy': specified size between 18446744071562067968 and 18446744073709551615 exceeds maximum object size 9223372036854775807 [-Wstringop-overflow=] + memcpy(av7110->debi_virt, (char *) &res, count); + +Apparently, 'count' can be negative here, which will then get turned +into a giant size argument for memcpy. Changing the sizes to 'unsigned +int' instead seems safe as we already check for maximum sizes, and it +also simplifies the code a bit. + +Signed-off-by: Arnd Bergmann +Signed-off-by: Mauro Carvalho Chehab +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/media/pci/ttpci/av7110_hw.c | 8 ++++---- + drivers/media/pci/ttpci/av7110_hw.h | 12 ++++++------ + 2 files changed, 10 insertions(+), 10 deletions(-) + +--- a/drivers/media/pci/ttpci/av7110_hw.c ++++ b/drivers/media/pci/ttpci/av7110_hw.c +@@ -56,11 +56,11 @@ + by Nathan Laredo */ + + int av7110_debiwrite(struct av7110 *av7110, u32 config, +- int addr, u32 val, int count) ++ int addr, u32 val, unsigned int count) + { + struct saa7146_dev *dev = av7110->dev; + +- if (count <= 0 || count > 32764) { ++ if (count > 32764) { + printk("%s: invalid count %d\n", __func__, count); + return -1; + } +@@ -78,12 +78,12 @@ int av7110_debiwrite(struct av7110 *av71 + return 0; + } + +-u32 av7110_debiread(struct av7110 *av7110, u32 config, int addr, int count) ++u32 av7110_debiread(struct av7110 *av7110, u32 config, int addr, unsigned int count) + { + struct saa7146_dev *dev = av7110->dev; + u32 result = 0; + +- if (count > 32764 || count <= 0) { ++ if (count > 32764) { + printk("%s: invalid count %d\n", __func__, count); + return 0; + } +--- a/drivers/media/pci/ttpci/av7110_hw.h ++++ b/drivers/media/pci/ttpci/av7110_hw.h +@@ -377,14 +377,14 @@ extern int av7110_fw_request(struct av71 + + /* DEBI (saa7146 data extension bus interface) access */ + extern int av7110_debiwrite(struct av7110 *av7110, u32 config, +- int addr, u32 val, int count); ++ int addr, u32 val, unsigned int count); + extern u32 av7110_debiread(struct av7110 *av7110, u32 config, +- int addr, int count); ++ int addr, unsigned int count); + + + /* DEBI during interrupt */ + /* single word writes */ +-static inline void iwdebi(struct av7110 *av7110, u32 config, int addr, u32 val, int count) ++static inline void iwdebi(struct av7110 *av7110, u32 config, int addr, u32 val, unsigned int count) + { + av7110_debiwrite(av7110, config, addr, val, count); + } +@@ -397,7 +397,7 @@ static inline void mwdebi(struct av7110 + av7110_debiwrite(av7110, config, addr, 0, count); + } + +-static inline u32 irdebi(struct av7110 *av7110, u32 config, int addr, u32 val, int count) ++static inline u32 irdebi(struct av7110 *av7110, u32 config, int addr, u32 val, unsigned int count) + { + u32 res; + +@@ -408,7 +408,7 @@ static inline u32 irdebi(struct av7110 * + } + + /* DEBI outside interrupts, only for count <= 4! */ +-static inline void wdebi(struct av7110 *av7110, u32 config, int addr, u32 val, int count) ++static inline void wdebi(struct av7110 *av7110, u32 config, int addr, u32 val, unsigned int count) + { + unsigned long flags; + +@@ -417,7 +417,7 @@ static inline void wdebi(struct av7110 * + spin_unlock_irqrestore(&av7110->debilock, flags); + } + +-static inline u32 rdebi(struct av7110 *av7110, u32 config, int addr, u32 val, int count) ++static inline u32 rdebi(struct av7110 *av7110, u32 config, int addr, u32 val, unsigned int count) + { + unsigned long flags; + u32 res; diff --git a/queue-4.13/series b/queue-4.13/series new file mode 100644 index 00000000000..ae960eab663 --- /dev/null +++ b/queue-4.13/series @@ -0,0 +1 @@ +imx-media-of-avoid-uninitialized-variable-warning.patch -- 2.47.3