Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'maybe-uninitialized' (patches from Arnd)

Merge fixes for -Wmaybe-uninitialized from Arnd Bergmann:
"It took a while for some patches to make it into mainline through
maintainer trees, but the 28-patch series is now reduced to 10, with
one tiny patch added at the end.

Aside from patches that are no longer required, I did these changes
compared to version 1:

- Dropped "iio: maxim_thermocouple: detect invalid storage size in
read()", which is currently in linux-next as commit 32cb7d27e65d.
This is the only remaining warning I see for a couple of corner
cases (kbuild bot reports it on blackfin, kernelci bot and arm-soc
bot both report it on arm64)

- Dropped "brcmfmac: avoid maybe-uninitialized warning in
brcmf_cfg80211_start_ap", which is currently in net/master merge
pending.

- Dropped two x86 patches, "x86: math-emu: possible uninitialized
variable use" and "x86: mark target address as output in 'insb'
asm" as they do not seem to trigger for a default build, and I got
no feedback on them. Both of these are ancient issues and seem
harmless, I will send them again to the x86 maintainers once the
rest is merged.

- Dropped "rbd: false-postive gcc-4.9 -Wmaybe-uninitialized" based on
feedback from Ilya Dryomov, who already has a different fix queued
up for v4.10. The kbuild bot reports this as a warning for xtensa.

- Replaced "crypto: aesni: avoid -Wmaybe-uninitialized warning" with
a simpler patch, this one always triggers but my first solution
would not be safe for linux-4.9 any more at this point. I'll follow
up with the larger patch as a cleanup for 4.10.

- Replaced "dib0700: fix nec repeat handling" with a better one,
contributed by Sean Young"

* -Wmaybe-uninitialized fixes:
Kbuild: enable -Wmaybe-uninitialized warnings by default
pcmcia: fix return value of soc_pcmcia_regulator_set
infiniband: shut up a maybe-uninitialized warning
crypto: aesni: shut up -Wmaybe-uninitialized warning
rc: print correct variable for z8f0811
dib0700: fix nec repeat handling
s390: pci: don't print uninitialized data for debugging
nios2: fix timer initcall return value
x86: apm: avoid uninitialized data
NFSv4.1: work around -Wmaybe-uninitialized warning
Kbuild: enable -Wmaybe-uninitialized warning for "make W=1"

+55 -39
+6 -4
Makefile
··· 370 370 CFLAGS_KERNEL = 371 371 AFLAGS_KERNEL = 372 372 LDFLAGS_vmlinux = 373 - CFLAGS_GCOV = -fprofile-arcs -ftest-coverage -fno-tree-loop-im 373 + CFLAGS_GCOV = -fprofile-arcs -ftest-coverage -fno-tree-loop-im -Wno-maybe-uninitialized 374 374 CFLAGS_KCOV := $(call cc-option,-fsanitize-coverage=trace-pc,) 375 375 376 376 ··· 620 620 include arch/$(SRCARCH)/Makefile 621 621 622 622 KBUILD_CFLAGS += $(call cc-option,-fno-delete-null-pointer-checks,) 623 - KBUILD_CFLAGS += $(call cc-disable-warning,maybe-uninitialized,) 624 623 KBUILD_CFLAGS += $(call cc-disable-warning,frame-address,) 625 624 626 625 ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION ··· 628 629 endif 629 630 630 631 ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE 631 - KBUILD_CFLAGS += -Os 632 + KBUILD_CFLAGS += -Os $(call cc-disable-warning,maybe-uninitialized,) 632 633 else 633 634 ifdef CONFIG_PROFILE_ALL_BRANCHES 634 - KBUILD_CFLAGS += -O2 635 + KBUILD_CFLAGS += -O2 $(call cc-disable-warning,maybe-uninitialized,) 635 636 else 636 637 KBUILD_CFLAGS += -O2 637 638 endif 638 639 endif 640 + 641 + KBUILD_CFLAGS += $(call cc-ifversion, -lt, 0409, \ 642 + $(call cc-disable-warning,maybe-uninitialized,)) 639 643 640 644 # Tell gcc to never replace conditional load with a non-conditional one 641 645 KBUILD_CFLAGS += $(call cc-option,--param=allow-store-data-races=0)
+3 -1
arch/arc/Makefile
··· 68 68 ifndef CONFIG_CC_OPTIMIZE_FOR_SIZE 69 69 # Generic build system uses -O2, we want -O3 70 70 # Note: No need to add to cflags-y as that happens anyways 71 - ARCH_CFLAGS += -O3 71 + # 72 + # Disable the false maybe-uninitialized warings gcc spits out at -O3 73 + ARCH_CFLAGS += -O3 $(call cc-disable-warning,maybe-uninitialized,) 72 74 endif 73 75 74 76 # small data is default for elf32 tool-chain. If not usable, disable it
+1
arch/nios2/kernel/time.c
··· 324 324 ret = nios2_clocksource_init(timer); 325 325 break; 326 326 default: 327 + ret = 0; 327 328 break; 328 329 } 329 330
+1 -1
arch/s390/pci/pci_dma.c
··· 423 423 dma_addr_t dma_addr_base, dma_addr; 424 424 int flags = ZPCI_PTE_VALID; 425 425 struct scatterlist *s; 426 - unsigned long pa; 426 + unsigned long pa = 0; 427 427 int ret; 428 428 429 429 size = PAGE_ALIGN(size);
+2 -2
arch/x86/crypto/aesni-intel_glue.c
··· 888 888 unsigned long auth_tag_len = crypto_aead_authsize(tfm); 889 889 u8 iv[16] __attribute__ ((__aligned__(AESNI_ALIGN))); 890 890 struct scatter_walk src_sg_walk; 891 - struct scatter_walk dst_sg_walk; 891 + struct scatter_walk dst_sg_walk = {}; 892 892 unsigned int i; 893 893 894 894 /* Assuming we are supporting rfc4106 64-bit extended */ ··· 968 968 u8 iv[16] __attribute__ ((__aligned__(AESNI_ALIGN))); 969 969 u8 authTag[16]; 970 970 struct scatter_walk src_sg_walk; 971 - struct scatter_walk dst_sg_walk; 971 + struct scatter_walk dst_sg_walk = {}; 972 972 unsigned int i; 973 973 974 974 if (unlikely(req->assoclen != 16 && req->assoclen != 20))
+4 -1
arch/x86/kernel/apm_32.c
··· 1042 1042 1043 1043 if (apm_info.get_power_status_broken) 1044 1044 return APM_32_UNSUPPORTED; 1045 - if (apm_bios_call(&call)) 1045 + if (apm_bios_call(&call)) { 1046 + if (!call.err) 1047 + return APM_NO_ERROR; 1046 1048 return call.err; 1049 + } 1047 1050 *status = call.ebx; 1048 1051 *bat = call.ecx; 1049 1052 if (apm_info.get_power_status_swabinminutes) {
+28 -26
drivers/infiniband/core/cma.c
··· 1094 1094 } 1095 1095 } 1096 1096 1097 - static void cma_save_ip4_info(struct sockaddr *src_addr, 1098 - struct sockaddr *dst_addr, 1097 + static void cma_save_ip4_info(struct sockaddr_in *src_addr, 1098 + struct sockaddr_in *dst_addr, 1099 1099 struct cma_hdr *hdr, 1100 1100 __be16 local_port) 1101 1101 { 1102 - struct sockaddr_in *ip4; 1103 - 1104 1102 if (src_addr) { 1105 - ip4 = (struct sockaddr_in *)src_addr; 1106 - ip4->sin_family = AF_INET; 1107 - ip4->sin_addr.s_addr = hdr->dst_addr.ip4.addr; 1108 - ip4->sin_port = local_port; 1103 + *src_addr = (struct sockaddr_in) { 1104 + .sin_family = AF_INET, 1105 + .sin_addr.s_addr = hdr->dst_addr.ip4.addr, 1106 + .sin_port = local_port, 1107 + }; 1109 1108 } 1110 1109 1111 1110 if (dst_addr) { 1112 - ip4 = (struct sockaddr_in *)dst_addr; 1113 - ip4->sin_family = AF_INET; 1114 - ip4->sin_addr.s_addr = hdr->src_addr.ip4.addr; 1115 - ip4->sin_port = hdr->port; 1111 + *dst_addr = (struct sockaddr_in) { 1112 + .sin_family = AF_INET, 1113 + .sin_addr.s_addr = hdr->src_addr.ip4.addr, 1114 + .sin_port = hdr->port, 1115 + }; 1116 1116 } 1117 1117 } 1118 1118 1119 - static void cma_save_ip6_info(struct sockaddr *src_addr, 1120 - struct sockaddr *dst_addr, 1119 + static void cma_save_ip6_info(struct sockaddr_in6 *src_addr, 1120 + struct sockaddr_in6 *dst_addr, 1121 1121 struct cma_hdr *hdr, 1122 1122 __be16 local_port) 1123 1123 { 1124 - struct sockaddr_in6 *ip6; 1125 - 1126 1124 if (src_addr) { 1127 - ip6 = (struct sockaddr_in6 *)src_addr; 1128 - ip6->sin6_family = AF_INET6; 1129 - ip6->sin6_addr = hdr->dst_addr.ip6; 1130 - ip6->sin6_port = local_port; 1125 + *src_addr = (struct sockaddr_in6) { 1126 + .sin6_family = AF_INET6, 1127 + .sin6_addr = hdr->dst_addr.ip6, 1128 + .sin6_port = local_port, 1129 + }; 1131 1130 } 1132 1131 1133 1132 if (dst_addr) { 1134 - ip6 = (struct sockaddr_in6 *)dst_addr; 1135 - ip6->sin6_family = AF_INET6; 1136 - ip6->sin6_addr = hdr->src_addr.ip6; 1137 - ip6->sin6_port = hdr->port; 1133 + *dst_addr = (struct sockaddr_in6) { 1134 + .sin6_family = AF_INET6, 1135 + .sin6_addr = hdr->src_addr.ip6, 1136 + .sin6_port = hdr->port, 1137 + }; 1138 1138 } 1139 1139 } 1140 1140 ··· 1159 1159 1160 1160 switch (cma_get_ip_ver(hdr)) { 1161 1161 case 4: 1162 - cma_save_ip4_info(src_addr, dst_addr, hdr, port); 1162 + cma_save_ip4_info((struct sockaddr_in *)src_addr, 1163 + (struct sockaddr_in *)dst_addr, hdr, port); 1163 1164 break; 1164 1165 case 6: 1165 - cma_save_ip6_info(src_addr, dst_addr, hdr, port); 1166 + cma_save_ip6_info((struct sockaddr_in6 *)src_addr, 1167 + (struct sockaddr_in6 *)dst_addr, hdr, port); 1166 1168 break; 1167 1169 default: 1168 1170 return -EAFNOSUPPORT;
+1 -1
drivers/media/i2c/ir-kbd-i2c.c
··· 118 118 *protocol = RC_TYPE_RC6_MCE; 119 119 dev &= 0x7f; 120 120 dprintk(1, "ir hauppauge (rc6-mce): t%d vendor=%d dev=%d code=%d\n", 121 - toggle, vendor, dev, code); 121 + *ptoggle, vendor, dev, code); 122 122 } else { 123 123 *ptoggle = 0; 124 124 *protocol = RC_TYPE_RC6_6A_32;
+3 -2
drivers/media/usb/dvb-usb/dib0700_core.c
··· 704 704 struct dvb_usb_device *d = purb->context; 705 705 struct dib0700_rc_response *poll_reply; 706 706 enum rc_type protocol; 707 - u32 uninitialized_var(keycode); 707 + u32 keycode; 708 708 u8 toggle; 709 709 710 710 deb_info("%s()\n", __func__); ··· 745 745 poll_reply->nec.data == 0x00 && 746 746 poll_reply->nec.not_data == 0xff) { 747 747 poll_reply->data_state = 2; 748 - break; 748 + rc_repeat(d->rc_dev); 749 + goto resubmit; 749 750 } 750 751 751 752 if ((poll_reply->nec.data ^ poll_reply->nec.not_data) != 0xff) {
+1 -1
drivers/pcmcia/soc_common.c
··· 107 107 108 108 ret = regulator_enable(r->reg); 109 109 } else { 110 - regulator_disable(r->reg); 110 + ret = regulator_disable(r->reg); 111 111 } 112 112 if (ret == 0) 113 113 r->on = on;
+1
scripts/Makefile.extrawarn
··· 36 36 warning-2 += $(call cc-option, -Wlogical-op) 37 37 warning-2 += $(call cc-option, -Wmissing-field-initializers) 38 38 warning-2 += $(call cc-option, -Wsign-compare) 39 + warning-2 += $(call cc-option, -Wmaybe-uninitialized) 39 40 40 41 warning-3 := -Wbad-function-cast 41 42 warning-3 += -Wcast-qual
+4
scripts/Makefile.ubsan
··· 17 17 ifdef CONFIG_UBSAN_NULL 18 18 CFLAGS_UBSAN += $(call cc-option, -fsanitize=null) 19 19 endif 20 + 21 + # -fsanitize=* options makes GCC less smart than usual and 22 + # increase number of 'maybe-uninitialized false-positives 23 + CFLAGS_UBSAN += $(call cc-option, -Wno-maybe-uninitialized) 20 24 endif