* [PATCH v2 01/11] Kbuild: enable -Wmaybe-uninitialized warning for "make W=1"
2016-11-10 16:44 [PATCH v2 00/11] getting back -Wmaybe-uninitialized Arnd Bergmann
@ 2016-11-10 16:44 ` Arnd Bergmann
2016-11-10 16:44 ` [PATCH v2 02/11] NFSv4.1: work around -Wmaybe-uninitialized warning Arnd Bergmann
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Arnd Bergmann @ 2016-11-10 16:44 UTC (permalink / raw)
To: Linus Torvalds
Cc: Sean Young, Trond Myklebust, linux-s390, Herbert Xu, x86,
Sebastian Ott, Russell King, Javier Martinez Canillas,
Ilya Dryomov, linux-snps-arc, linux-media, Arnd Bergmann,
linux-kbuild, Jiri Kosina, Michal Marek, nios2-dev,
Mauro Carvalho Chehab, linux-nfs, linux-kernel, Anna Schumaker,
Luis R . Rodriguez, linux-crypto, Martin Schwidefsky,
Ley Foon Tan, Andrew Morton
Traditionally, we have always had warnings about uninitialized variables
enabled, as this is part of -Wall, and generally a good idea [1], but it
also always produced false positives, mainly because this is a variation
of the halting problem and provably impossible to get right in all cases
[2].
Various people have identified cases that are particularly bad for false
positives, and in commit e74fc973b6e5 ("Turn off -Wmaybe-uninitialized
when building with -Os"), I turned off the warning for any build that
was done with CC_OPTIMIZE_FOR_SIZE. This drastically reduced the number
of false positive warnings in the default build but unfortunately had
the side effect of turning the warning off completely in 'allmodconfig'
builds, which in turn led to a lot of warnings (both actual bugs, and
remaining false positives) to go in unnoticed.
With commit 877417e6ffb9 ("Kbuild: change CC_OPTIMIZE_FOR_SIZE
definition") enabled the warning again for allmodconfig builds in v4.7
and in v4.8-rc1, I had finally managed to address all warnings I get in
an ARM allmodconfig build and most other maybe-uninitialized warnings
for ARM randconfig builds.
However, commit 6e8d666e9253 ("Disable "maybe-uninitialized" warning
globally") was merged at the same time and disabled it completely for
all configurations, because of false-positive warnings on x86 that I had
not addressed until then. This caused a lot of actual bugs to get merged
into mainline, and I sent several dozen patches for these during the v4.9
development cycle. Most of these are actual bugs, some are for correct
code that is safe because it is only called under external constraints
that make it impossible to run into the case that gcc sees, and in a
few cases gcc is just stupid and finds something that can obviously
never happen.
I have now done a few thousand randconfig builds on x86 and collected all
patches that I needed to address every single warning I got (I can provide
the combined patch for the other warnings if anyone is interested),
so I hope we can get the warning back and let people catch the actual
bugs earlier.
This reverts the change to disable the warning completely and for
now brings it back at the "make W=1" level, so we can get it merged
into mainline without introducing false positives. A follow-up
patch enables it on all levels unless some configuration option
turns it off because of false-positives.
Link: https://rusty.ozlabs.org/?p=232 [1]
Link: https://gcc.gnu.org/wiki/Better_Uninitialized_Warnings [2]
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
Makefile | 10 ++++++----
arch/arc/Makefile | 4 +++-
| 3 +++
scripts/Makefile.ubsan | 4 ++++
4 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/Makefile b/Makefile
index f97f786..06e2b73 100644
--- a/Makefile
+++ b/Makefile
@@ -370,7 +370,7 @@ LDFLAGS_MODULE =
CFLAGS_KERNEL =
AFLAGS_KERNEL =
LDFLAGS_vmlinux =
-CFLAGS_GCOV = -fprofile-arcs -ftest-coverage -fno-tree-loop-im
+CFLAGS_GCOV = -fprofile-arcs -ftest-coverage -fno-tree-loop-im -Wno-maybe-uninitialized
CFLAGS_KCOV := $(call cc-option,-fsanitize-coverage=trace-pc,)
@@ -620,7 +620,6 @@ ARCH_CFLAGS :=
include arch/$(SRCARCH)/Makefile
KBUILD_CFLAGS += $(call cc-option,-fno-delete-null-pointer-checks,)
-KBUILD_CFLAGS += $(call cc-disable-warning,maybe-uninitialized,)
KBUILD_CFLAGS += $(call cc-disable-warning,frame-address,)
ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION
@@ -629,15 +628,18 @@ KBUILD_CFLAGS += $(call cc-option,-fdata-sections,)
endif
ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
-KBUILD_CFLAGS += -Os
+KBUILD_CFLAGS += -Os $(call cc-disable-warning,maybe-uninitialized,)
else
ifdef CONFIG_PROFILE_ALL_BRANCHES
-KBUILD_CFLAGS += -O2
+KBUILD_CFLAGS += -O2 $(call cc-disable-warning,maybe-uninitialized,)
else
KBUILD_CFLAGS += -O2
endif
endif
+KBUILD_CFLAGS += $(call cc-ifversion, -lt, 0409, \
+ $(call cc-disable-warning,maybe-uninitialized,))
+
# Tell gcc to never replace conditional load with a non-conditional one
KBUILD_CFLAGS += $(call cc-option,--param=allow-store-data-races=0)
diff --git a/arch/arc/Makefile b/arch/arc/Makefile
index 864adad..25f81a1 100644
--- a/arch/arc/Makefile
+++ b/arch/arc/Makefile
@@ -68,7 +68,9 @@ cflags-$(CONFIG_ARC_DW2_UNWIND) += -fasynchronous-unwind-tables $(cfi)
ifndef CONFIG_CC_OPTIMIZE_FOR_SIZE
# Generic build system uses -O2, we want -O3
# Note: No need to add to cflags-y as that happens anyways
-ARCH_CFLAGS += -O3
+#
+# Disable the false maybe-uninitialized warings gcc spits out at -O3
+ARCH_CFLAGS += -O3 $(call cc-disable-warning,maybe-uninitialized,)
endif
# small data is default for elf32 tool-chain. If not usable, disable it
--git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
index 53449a6..7fc2c5a 100644
--- a/scripts/Makefile.extrawarn
+++ b/scripts/Makefile.extrawarn
@@ -36,6 +36,7 @@ warning-2 += -Wshadow
warning-2 += $(call cc-option, -Wlogical-op)
warning-2 += $(call cc-option, -Wmissing-field-initializers)
warning-2 += $(call cc-option, -Wsign-compare)
+warning-2 += $(call cc-option, -Wmaybe-uninitialized)
warning-3 := -Wbad-function-cast
warning-3 += -Wcast-qual
@@ -59,6 +60,8 @@ endif
KBUILD_CFLAGS += $(warning)
else
+KBUILD_CFLAGS += $(call cc-disable-warning, maybe-uninitialized)
+
ifeq ($(cc-name),clang)
KBUILD_CFLAGS += $(call cc-disable-warning, initializer-overrides)
KBUILD_CFLAGS += $(call cc-disable-warning, unused-value)
diff --git a/scripts/Makefile.ubsan b/scripts/Makefile.ubsan
index dd779c4..3b1b138 100644
--- a/scripts/Makefile.ubsan
+++ b/scripts/Makefile.ubsan
@@ -17,4 +17,8 @@ endif
ifdef CONFIG_UBSAN_NULL
CFLAGS_UBSAN += $(call cc-option, -fsanitize=null)
endif
+
+ # -fsanitize=* options makes GCC less smart than usual and
+ # increase number of 'maybe-uninitialized false-positives
+ CFLAGS_UBSAN += $(call cc-option, -Wno-maybe-uninitialized)
endif
--
2.9.0
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH v2 02/11] NFSv4.1: work around -Wmaybe-uninitialized warning
2016-11-10 16:44 [PATCH v2 00/11] getting back -Wmaybe-uninitialized Arnd Bergmann
2016-11-10 16:44 ` [PATCH v2 01/11] Kbuild: enable -Wmaybe-uninitialized warning for "make W=1" Arnd Bergmann
@ 2016-11-10 16:44 ` Arnd Bergmann
2016-11-10 16:44 ` [PATCH v2 04/11] nios2: fix timer initcall return value Arnd Bergmann
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Arnd Bergmann @ 2016-11-10 16:44 UTC (permalink / raw)
To: Linus Torvalds
Cc: Sean Young, Trond Myklebust, linux-s390, Herbert Xu, x86,
Sebastian Ott, Russell King, Javier Martinez Canillas,
Ilya Dryomov, linux-snps-arc, linux-media, Arnd Bergmann,
linux-kbuild, Jiri Kosina, Michal Marek, nios2-dev,
Mauro Carvalho Chehab, linux-nfs, linux-kernel, Anna Schumaker,
Luis R . Rodriguez, linux-crypto, Martin Schwidefsky,
Ley Foon Tan, Andrew Morton
A bugfix introduced a harmless gcc warning in nfs4_slot_seqid_in_use
if we enable -Wmaybe-uninitialized again:
fs/nfs/nfs4session.c:203:54: error: 'cur_seq' may be used uninitialized in this function [-Werror=maybe-uninitialized]
gcc is not smart enough to conclude that the IS_ERR/PTR_ERR pair
results in a nonzero return value here. Using PTR_ERR_OR_ZERO()
instead makes this clear to the compiler.
Fixes: e09c978aae5b ("NFSv4.1: Fix Oopsable condition in server callback races")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
First submitted on Aug 31, but ended up not getting applied then
as the warning was disabled in v4.8-rc
Anna Schumaker said at the kernel summit that she had applied
it and would send it for 4.9, but as of 2016-11-09 it has not
made it into linux-next.
fs/nfs/nfs4session.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/fs/nfs/nfs4session.c b/fs/nfs/nfs4session.c
index b629730..150c5a1 100644
--- a/fs/nfs/nfs4session.c
+++ b/fs/nfs/nfs4session.c
@@ -178,12 +178,14 @@ static int nfs4_slot_get_seqid(struct nfs4_slot_table *tbl, u32 slotid,
__must_hold(&tbl->slot_tbl_lock)
{
struct nfs4_slot *slot;
+ int ret;
slot = nfs4_lookup_slot(tbl, slotid);
- if (IS_ERR(slot))
- return PTR_ERR(slot);
- *seq_nr = slot->seq_nr;
- return 0;
+ ret = PTR_ERR_OR_ZERO(slot);
+ if (!ret)
+ *seq_nr = slot->seq_nr;
+
+ return ret;
}
/*
--
2.9.0
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH v2 04/11] nios2: fix timer initcall return value
2016-11-10 16:44 [PATCH v2 00/11] getting back -Wmaybe-uninitialized Arnd Bergmann
2016-11-10 16:44 ` [PATCH v2 01/11] Kbuild: enable -Wmaybe-uninitialized warning for "make W=1" Arnd Bergmann
2016-11-10 16:44 ` [PATCH v2 02/11] NFSv4.1: work around -Wmaybe-uninitialized warning Arnd Bergmann
@ 2016-11-10 16:44 ` Arnd Bergmann
2016-11-10 16:44 ` [PATCH v2 05/11] s390: pci: don't print uninitialized data for debugging Arnd Bergmann
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Arnd Bergmann @ 2016-11-10 16:44 UTC (permalink / raw)
To: Linus Torvalds
Cc: Sean Young, Trond Myklebust, linux-s390, Herbert Xu, x86,
Sebastian Ott, Russell King, Javier Martinez Canillas,
Ilya Dryomov, linux-snps-arc, linux-media, Arnd Bergmann,
linux-kbuild, Jiri Kosina, Michal Marek, nios2-dev,
Mauro Carvalho Chehab, linux-nfs, linux-kernel, Anna Schumaker,
Luis R . Rodriguez, linux-crypto, Martin Schwidefsky,
Ley Foon Tan, Andrew Morton
When called more than twice, the nios2_time_init() function
return an uninitialized value, as detected by gcc -Wmaybe-uninitialized
arch/nios2/kernel/time.c: warning: 'ret' may be used uninitialized in this function
This makes it return '0' here, matching the comment above the
function.
Acked-by: Ley Foon Tan <lftan@altera.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
arch/nios2/kernel/time.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/nios2/kernel/time.c b/arch/nios2/kernel/time.c
index d9563dd..746bf5c 100644
--- a/arch/nios2/kernel/time.c
+++ b/arch/nios2/kernel/time.c
@@ -324,6 +324,7 @@ static int __init nios2_time_init(struct device_node *timer)
ret = nios2_clocksource_init(timer);
break;
default:
+ ret = 0;
break;
}
--
2.9.0
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH v2 05/11] s390: pci: don't print uninitialized data for debugging
2016-11-10 16:44 [PATCH v2 00/11] getting back -Wmaybe-uninitialized Arnd Bergmann
` (2 preceding siblings ...)
2016-11-10 16:44 ` [PATCH v2 04/11] nios2: fix timer initcall return value Arnd Bergmann
@ 2016-11-10 16:44 ` Arnd Bergmann
2016-11-10 16:44 ` [PATCH v2 07/11] [media] rc: print correct variable for z8f0811 Arnd Bergmann
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Arnd Bergmann @ 2016-11-10 16:44 UTC (permalink / raw)
To: Linus Torvalds
Cc: Sean Young, Trond Myklebust, linux-s390, Herbert Xu, x86,
Sebastian Ott, Russell King, Javier Martinez Canillas,
Ilya Dryomov, linux-snps-arc, linux-media, Arnd Bergmann,
linux-kbuild, Jiri Kosina, Michal Marek, nios2-dev,
Mauro Carvalho Chehab, linux-nfs, linux-kernel, Anna Schumaker,
Luis R . Rodriguez, linux-crypto, Martin Schwidefsky,
Ley Foon Tan, Andrew Morton
gcc correctly warns about an incorrect use of the 'pa' variable
in case we pass an empty scatterlist to __s390_dma_map_sg:
arch/s390/pci/pci_dma.c: In function '__s390_dma_map_sg':
arch/s390/pci/pci_dma.c:309:13: warning: 'pa' may be used uninitialized in this function [-Wmaybe-uninitialized]
This adds a bogus initialization to the function to sanitize
the debug output. I would have preferred a solution without
the initialization, but I only got the report from the
kbuild bot after turning on the warning again, and didn't
manage to reproduce it myself.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Acked-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
---
arch/s390/pci/pci_dma.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/s390/pci/pci_dma.c b/arch/s390/pci/pci_dma.c
index 7350c8b..6b2f72f 100644
--- a/arch/s390/pci/pci_dma.c
+++ b/arch/s390/pci/pci_dma.c
@@ -423,7 +423,7 @@ static int __s390_dma_map_sg(struct device *dev, struct scatterlist *sg,
dma_addr_t dma_addr_base, dma_addr;
int flags = ZPCI_PTE_VALID;
struct scatterlist *s;
- unsigned long pa;
+ unsigned long pa = 0;
int ret;
size = PAGE_ALIGN(size);
--
2.9.0
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH v2 07/11] [media] rc: print correct variable for z8f0811
2016-11-10 16:44 [PATCH v2 00/11] getting back -Wmaybe-uninitialized Arnd Bergmann
` (3 preceding siblings ...)
2016-11-10 16:44 ` [PATCH v2 05/11] s390: pci: don't print uninitialized data for debugging Arnd Bergmann
@ 2016-11-10 16:44 ` Arnd Bergmann
2016-11-10 16:44 ` [PATCH v2 09/11] [v3] infiniband: shut up a maybe-uninitialized warning Arnd Bergmann
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Arnd Bergmann @ 2016-11-10 16:44 UTC (permalink / raw)
To: Linus Torvalds
Cc: Sean Young, Trond Myklebust, linux-s390, Herbert Xu, x86,
Sebastian Ott, Russell King, Javier Martinez Canillas,
Ilya Dryomov, linux-snps-arc, linux-media, Arnd Bergmann,
linux-kbuild, Jiri Kosina, Michal Marek, nios2-dev,
Mauro Carvalho Chehab, linux-nfs, linux-kernel, Anna Schumaker,
Luis R . Rodriguez, linux-crypto, Martin Schwidefsky,
Ley Foon Tan, Andrew Morton
A recent rework accidentally left a debugging printk untouched
while changing the meaning of the variables, leading to an
uninitialized variable being printed:
drivers/media/i2c/ir-kbd-i2c.c: In function 'get_key_haup_common':
drivers/media/i2c/ir-kbd-i2c.c:62:2: error: 'toggle' may be used uninitialized in this function [-Werror=maybe-uninitialized]
This prints the correct one instead, as we did before the patch.
Fixes: 00bb820755ed ("[media] rc: Hauppauge z8f0811 can decode RC6")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/media/i2c/ir-kbd-i2c.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
I submitted this repeatedly as it is a v4.9 regression, but
I never saw a reply for it.
diff --git a/drivers/media/i2c/ir-kbd-i2c.c b/drivers/media/i2c/ir-kbd-i2c.c
index f95a6bc..cede397 100644
--- a/drivers/media/i2c/ir-kbd-i2c.c
+++ b/drivers/media/i2c/ir-kbd-i2c.c
@@ -118,7 +118,7 @@ static int get_key_haup_common(struct IR_i2c *ir, enum rc_type *protocol,
*protocol = RC_TYPE_RC6_MCE;
dev &= 0x7f;
dprintk(1, "ir hauppauge (rc6-mce): t%d vendor=%d dev=%d code=%d\n",
- toggle, vendor, dev, code);
+ *ptoggle, vendor, dev, code);
} else {
*ptoggle = 0;
*protocol = RC_TYPE_RC6_6A_32;
--
2.9.0
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH v2 09/11] [v3] infiniband: shut up a maybe-uninitialized warning
2016-11-10 16:44 [PATCH v2 00/11] getting back -Wmaybe-uninitialized Arnd Bergmann
` (4 preceding siblings ...)
2016-11-10 16:44 ` [PATCH v2 07/11] [media] rc: print correct variable for z8f0811 Arnd Bergmann
@ 2016-11-10 16:44 ` Arnd Bergmann
2016-11-10 16:44 ` [PATCH v2 11/11] Kbuild: enable -Wmaybe-uninitialized warnings by default Arnd Bergmann
[not found] ` <CA+55aFx_scFVFKU__TBmoffw_iHvrdAU2dj5u1WKfWJXAkS4QA@mail.gmail.com>
7 siblings, 0 replies; 9+ messages in thread
From: Arnd Bergmann @ 2016-11-10 16:44 UTC (permalink / raw)
To: Linus Torvalds
Cc: Sean Young, Trond Myklebust, linux-s390, Herbert Xu, x86,
Sebastian Ott, Russell King, Javier Martinez Canillas,
Ilya Dryomov, linux-snps-arc, linux-media, Arnd Bergmann,
linux-kbuild, Jiri Kosina, Michal Marek, nios2-dev,
Mauro Carvalho Chehab, linux-nfs, linux-kernel, Anna Schumaker,
Luis R . Rodriguez, linux-crypto, Martin Schwidefsky,
Ley Foon Tan, Andrew Morton
Some configurations produce this harmless warning when built with
gcc -Wmaybe-uninitialized:
infiniband/core/cma.c: In function 'cma_get_net_dev':
infiniband/core/cma.c:1242:12: warning: 'src_addr_storage.sin_addr.s_addr' may be used uninitialized in this function [-Wmaybe-uninitialized]
I previously reported this for the powerpc64 defconfig, but have now
reproduced the same thing for x86 as well, using gcc-5 or higher.
The code looks correct to me, and this change just rearranges it
by making sure we alway initialize the entire address structure
to make the warning disappear. My first approach added an
initialization at the time of the declaration, which Doug commented
may be too costly, so I hope this version doesn't add overhead.
Link: http://arm-soc.lixom.net/buildlogs/mainline/v4.7-rc6/buildall.powerpc.ppc64_defconfig.log.passed
Link: https://patchwork.kernel.org/patch/9212825/
Acked-by: Haggai Eran <haggaie@mellanox.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
This is marked v2 as the rest of the series but is actually version
three of the patch as I had to do some other changes already.
v3: remove accidental leftover change of the original patch
drivers/infiniband/core/cma.c | 54 ++++++++++++++++++++++---------------------
1 file changed, 28 insertions(+), 26 deletions(-)
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
index 36bf50e..89a6b05 100644
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -1094,47 +1094,47 @@ static void cma_save_ib_info(struct sockaddr *src_addr,
}
}
-static void cma_save_ip4_info(struct sockaddr *src_addr,
- struct sockaddr *dst_addr,
+static void cma_save_ip4_info(struct sockaddr_in *src_addr,
+ struct sockaddr_in *dst_addr,
struct cma_hdr *hdr,
__be16 local_port)
{
- struct sockaddr_in *ip4;
-
if (src_addr) {
- ip4 = (struct sockaddr_in *)src_addr;
- ip4->sin_family = AF_INET;
- ip4->sin_addr.s_addr = hdr->dst_addr.ip4.addr;
- ip4->sin_port = local_port;
+ *src_addr = (struct sockaddr_in) {
+ .sin_family = AF_INET,
+ .sin_addr.s_addr = hdr->dst_addr.ip4.addr,
+ .sin_port = local_port,
+ };
}
if (dst_addr) {
- ip4 = (struct sockaddr_in *)dst_addr;
- ip4->sin_family = AF_INET;
- ip4->sin_addr.s_addr = hdr->src_addr.ip4.addr;
- ip4->sin_port = hdr->port;
+ *dst_addr = (struct sockaddr_in) {
+ .sin_family = AF_INET,
+ .sin_addr.s_addr = hdr->src_addr.ip4.addr,
+ .sin_port = hdr->port,
+ };
}
}
-static void cma_save_ip6_info(struct sockaddr *src_addr,
- struct sockaddr *dst_addr,
+static void cma_save_ip6_info(struct sockaddr_in6 *src_addr,
+ struct sockaddr_in6 *dst_addr,
struct cma_hdr *hdr,
__be16 local_port)
{
- struct sockaddr_in6 *ip6;
-
if (src_addr) {
- ip6 = (struct sockaddr_in6 *)src_addr;
- ip6->sin6_family = AF_INET6;
- ip6->sin6_addr = hdr->dst_addr.ip6;
- ip6->sin6_port = local_port;
+ *src_addr = (struct sockaddr_in6) {
+ .sin6_family = AF_INET6,
+ .sin6_addr = hdr->dst_addr.ip6,
+ .sin6_port = local_port,
+ };
}
if (dst_addr) {
- ip6 = (struct sockaddr_in6 *)dst_addr;
- ip6->sin6_family = AF_INET6;
- ip6->sin6_addr = hdr->src_addr.ip6;
- ip6->sin6_port = hdr->port;
+ *dst_addr = (struct sockaddr_in6) {
+ .sin6_family = AF_INET6,
+ .sin6_addr = hdr->src_addr.ip6,
+ .sin6_port = hdr->port,
+ };
}
}
@@ -1159,10 +1159,12 @@ static int cma_save_ip_info(struct sockaddr *src_addr,
switch (cma_get_ip_ver(hdr)) {
case 4:
- cma_save_ip4_info(src_addr, dst_addr, hdr, port);
+ cma_save_ip4_info((struct sockaddr_in *)src_addr,
+ (struct sockaddr_in *)dst_addr, hdr, port);
break;
case 6:
- cma_save_ip6_info(src_addr, dst_addr, hdr, port);
+ cma_save_ip6_info((struct sockaddr_in6 *)src_addr,
+ (struct sockaddr_in6 *)dst_addr, hdr, port);
break;
default:
return -EAFNOSUPPORT;
--
2.9.0
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH v2 11/11] Kbuild: enable -Wmaybe-uninitialized warnings by default
2016-11-10 16:44 [PATCH v2 00/11] getting back -Wmaybe-uninitialized Arnd Bergmann
` (5 preceding siblings ...)
2016-11-10 16:44 ` [PATCH v2 09/11] [v3] infiniband: shut up a maybe-uninitialized warning Arnd Bergmann
@ 2016-11-10 16:44 ` Arnd Bergmann
[not found] ` <CA+55aFx_scFVFKU__TBmoffw_iHvrdAU2dj5u1WKfWJXAkS4QA@mail.gmail.com>
7 siblings, 0 replies; 9+ messages in thread
From: Arnd Bergmann @ 2016-11-10 16:44 UTC (permalink / raw)
To: Linus Torvalds
Cc: Sean Young, Trond Myklebust, linux-s390, Herbert Xu, x86,
Sebastian Ott, Russell King, Javier Martinez Canillas,
Ilya Dryomov, linux-snps-arc, linux-media, Arnd Bergmann,
linux-kbuild, Jiri Kosina, Michal Marek, nios2-dev,
Mauro Carvalho Chehab, linux-nfs, linux-kernel, Anna Schumaker,
Luis R . Rodriguez, linux-crypto, Martin Schwidefsky,
Ley Foon Tan, Andrew Morton
Previously the warnings were added back at the W=1 level and above,
this now turns them on again by default, assuming that we have addressed
all warnings and again have a clean build for v4.10.
I found a number of new warnings in linux-next already and submitted
bugfixes for those. Hopefully they are caught by the 0day builder
in the future as soon as this patch is merged.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
Please check if there are any remaining warnings with this
patch before applying.
The one known issue right now is commit 32cb7d27e65d ("iio:
maxim_thermocouple: detect invalid storage size in read()"), which
is currently in linux-next but not yet in mainline.
There are a couple of warnings that I get with randconfig builds,
and I have submitted patches for all of them at some point and
will follow up on them to make sure they get addressed eventually.
---
| 2 --
1 file changed, 2 deletions(-)
--git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
index 7fc2c5a..7c321a6 100644
--- a/scripts/Makefile.extrawarn
+++ b/scripts/Makefile.extrawarn
@@ -60,8 +60,6 @@ endif
KBUILD_CFLAGS += $(warning)
else
-KBUILD_CFLAGS += $(call cc-disable-warning, maybe-uninitialized)
-
ifeq ($(cc-name),clang)
KBUILD_CFLAGS += $(call cc-disable-warning, initializer-overrides)
KBUILD_CFLAGS += $(call cc-disable-warning, unused-value)
--
2.9.0
^ permalink raw reply related [flat|nested] 9+ messages in thread[parent not found: <CA+55aFx_scFVFKU__TBmoffw_iHvrdAU2dj5u1WKfWJXAkS4QA@mail.gmail.com>]
* Re: [PATCH v2 00/11] getting back -Wmaybe-uninitialized
[not found] ` <CA+55aFx_scFVFKU__TBmoffw_iHvrdAU2dj5u1WKfWJXAkS4QA@mail.gmail.com>
@ 2016-11-11 19:49 ` Arnd Bergmann
0 siblings, 0 replies; 9+ messages in thread
From: Arnd Bergmann @ 2016-11-11 19:49 UTC (permalink / raw)
To: Linus Torvalds
Cc: Sean Young, sayli karnik, Trond Myklebust, Srinivas Kandagatla,
linux-s390, Herbert Xu, the arch/x86 maintainers, Sebastian Ott,
Russell King, Javier Martinez Canillas, Ilya Dryomov, arcml,
Linux Media Mailing List, Linux Kbuild mailing list, Jiri Kosina,
Mark Brown, nios2-dev, Mauro Carvalho Chehab,
Linux NFS Mailing List, gregkh
On Friday, November 11, 2016 9:13:00 AM CET Linus Torvalds wrote:
> On Thu, Nov 10, 2016 at 8:44 AM, Arnd Bergmann <arnd@arndb.de> wrote:
> >
> > Please merge these directly if you are happy with the result.
>
> I will take this.
Thanks a lot!
> I do see two warnings, but they both seem to be valid and recent,
> though, so I have no issues with the spurious cases.
Ok, both of them should have my fixes coming your way already.
> Warning #1:
>
> sound/soc/qcom/lpass-platform.c: In function ‘lpass_platform_pcmops_open’:
> sound/soc/qcom/lpass-platform.c:83:29: warning: ‘dma_ch’ may be used
> uninitialized in this function [-Wmaybe-uninitialized]
> drvdata->substream[dma_ch] = substream;
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
>
> and 'dma_ch' usage there really is crazy and wrong. Broken by
> 022d00ee0b55 ("ASoC: lpass-platform: Fix broken pcm data usage")
Right, the patches crossed here, the bugfix patch that introduced
this came into linux-next over the kernel summit, and the fix I
sent on Tuesday made it into Mark Brown's tree on Wednesday but not
before you pulled alsa tree. It should be fixed the next time you
pull from the alsa tree, the commit is
3b89e4b77ef9 ("ASoC: lpass-platform: initialize dma channel number")
> Warning #2 is not a real bug, but it's reasonable that gcc doesn't
> know that storage_bytes (chip->read_size) has to be 2/4. Again,
> introduced recently by commit 231147ee77f3 ("iio: maxim_thermocouple:
> Align 16 bit big endian value of raw reads"), so you didn't see it.
This is the one I mentioned in the commit message as one that
is fixed in linux-next and that should make it in soon.
> drivers/iio/temperature/maxim_thermocouple.c: In function
> ‘maxim_thermocouple_read_raw’:
> drivers/iio/temperature/maxim_thermocouple.c:141:5: warning: ‘ret’
> may be used uninitialized in this function [-Wmaybe-uninitialized]
> if (ret)
> ^
> drivers/iio/temperature/maxim_thermocouple.c:128:6: note: ‘ret’ was
> declared here
> int ret;
> ^~~
>
> and I guess that code can just initialize 'ret' to '-EINVAL' or
> something to just make the theoretical "somehow we had a wrong
> chip->read_size" case error out cleanly.
Right, that was my conclusion too. I sent the bugfix on Oct 25
for linux-next but it didn't make it in until this Monday, after
you pulled the patch that introduced it on Oct 29.
The commit in staging-testing is
32cb7d27e65d ("iio: maxim_thermocouple: detect invalid storage size in read()")
Greg and Jonathan, I see now that this is part of the 'iio-for-4.10b'
branch, so I suspect you were not planning to send this before the
merge window. Could you make sure this ends up in v4.9 so we get
a clean build when -Wmaybe-uninitialized gets enabled again?
Arnd
_______________________________________________
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc
^ permalink raw reply [flat|nested] 9+ messages in thread