Messages in this thread | | | From | Zzy Wysm <> | Subject | Linux Warning Report - 5.6-rc2 | Date | Sun, 16 Feb 2020 18:53:07 -0600 |
| |
On February 12, 2020, Linus Torvalds wrote: "I do not want to see a _single_ warning in the kernel build. Yes, we have one in the samples code, and even that annoys the hell out of me.”
(Source: <https://lkml.org/lkml/2020/2/12/996>)
A noble goal, and one I endorse.
With that in mind, I decided to see if the Linux kernel truly builds warning-free. Spoiler: it did not. I built Linux 5.6-rc2 with gcc 9.2.1-9ubuntu2 using make defconfig.
Result: 33 warnings.
Let me know if you’re interested in: * regular warning reports * additional code coverage beyond defconfig * additional warning types
(Note, I am not a member of this list, please include me directly on any replies.)
Regards, zzy
zzy@esquivalience:~/linux-5.6-rc2$ make -j6 KCFLAGS="-Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers" > build_log_5.6-rc2 kernel/time/hrtimer.c:120:21: warning: initialized field overwritten [-Woverride-init] 120 | [CLOCK_REALTIME] = HRTIMER_BASE_REALTIME, | ^~~~~~~~~~~~~~~~~~~~~ kernel/time/hrtimer.c:120:21: note: (near initialization for ‘hrtimer_clock_to_base_table[0]’) kernel/time/hrtimer.c:121:22: warning: initialized field overwritten [-Woverride-init] 121 | [CLOCK_MONOTONIC] = HRTIMER_BASE_MONOTONIC, | ^~~~~~~~~~~~~~~~~~~~~~ kernel/time/hrtimer.c:121:22: note: (near initialization for ‘hrtimer_clock_to_base_table[1]’) kernel/time/hrtimer.c:122:21: warning: initialized field overwritten [-Woverride-init] 122 | [CLOCK_BOOTTIME] = HRTIMER_BASE_BOOTTIME, | ^~~~~~~~~~~~~~~~~~~~~ kernel/time/hrtimer.c:122:21: note: (near initialization for ‘hrtimer_clock_to_base_table[7]’) kernel/time/hrtimer.c:123:17: warning: initialized field overwritten [-Woverride-init] 123 | [CLOCK_TAI] = HRTIMER_BASE_TAI, | ^~~~~~~~~~~~~~~~ kernel/time/hrtimer.c:123:17: note: (near initialization for ‘hrtimer_clock_to_base_table[11]’) In file included from kernel/bpf/core.c:21: kernel/bpf/core.c: In function ‘___bpf_prog_run’: ./include/linux/filter.h:863:3: warning: cast between incompatible function types from ‘u64 (*)(u64, u64, u64, u64, u64)’ {aka ‘long long unsigned int (*)(long long unsigned int, long long unsigned int, long long unsigned int, long long unsigned int, long long unsigned int)’} to ‘u64 (*)(u64, u64, u64, u64, u64, const struct bpf_insn *)’ {aka ‘long long unsigned int (*)(long long unsigned int, long long unsigned int, long long unsigned int, long long unsigned int, long long unsigned int, const struct bpf_insn *)’} [-Wcast-function-type] 863 | ((u64 (*)(u64, u64, u64, u64, u64, const struct bpf_insn *)) \ | ^ kernel/bpf/core.c:1513:13: note: in expansion of macro ‘__bpf_call_base_args’ 1513 | BPF_R0 = (__bpf_call_base_args + insn->imm)(BPF_R1, BPF_R2, | ^~~~~~~~~~~~~~~~~~~~ kernel/bpf/core.c: In function ‘bpf_patch_call_args’: ./include/linux/filter.h:863:3: warning: cast between incompatible function types from ‘u64 (*)(u64, u64, u64, u64, u64)’ {aka ‘long long unsigned int (*)(long long unsigned int, long long unsigned int, long long unsigned int, long long unsigned int, long long unsigned int)’} to ‘u64 (*)(u64, u64, u64, u64, u64, const struct bpf_insn *)’ {aka ‘long long unsigned int (*)(long long unsigned int, long long unsigned int, long long unsigned int, long long unsigned int, long long unsigned int, const struct bpf_insn *)’} [-Wcast-function-type] 863 | ((u64 (*)(u64, u64, u64, u64, u64, const struct bpf_insn *)) \ | ^ kernel/bpf/core.c:1704:3: note: in expansion of macro ‘__bpf_call_base_args’ 1704 | __bpf_call_base_args; | ^~~~~~~~~~~~~~~~~~~~ arch/x86/kernel/jump_label.c:61:1: warning: ‘inline’ is not at beginning of declaration [-Wold-style-declaration] 61 | static void inline __jump_label_transform(struct jump_entry *entry, | ^~~~~~ kernel/trace/blktrace.c: In function ‘__trace_note_message’: kernel/trace/blktrace.c:145:63: warning: parameter ‘blkcg’ set but not used [-Wunused-but-set-parameter] 145 | void __trace_note_message(struct blk_trace *bt, struct blkcg *blkcg, | ~~~~~~~~~~~~~~^~~~~ In file included from ./include/linux/capability.h:16, from security/commoncap.c:5: security/commoncap.c: In function ‘cap_prctl_drop’: ./include/uapi/linux/capability.h:373:27: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits] 373 | #define cap_valid(x) ((x) >= 0 && (x) <= CAP_LAST_CAP) | ^~ security/commoncap.c:1145:7: note: in expansion of macro ‘cap_valid’ 1145 | if (!cap_valid(cap)) | ^~~~~~~~~ security/commoncap.c: In function ‘cap_task_prctl’: ./include/uapi/linux/capability.h:373:27: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits] 373 | #define cap_valid(x) ((x) >= 0 && (x) <= CAP_LAST_CAP) | ^~ security/commoncap.c:1175:8: note: in expansion of macro ‘cap_valid’ 1175 | if (!cap_valid(arg2)) | ^~~~~~~~~ ./include/uapi/linux/capability.h:373:27: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits] 373 | #define cap_valid(x) ((x) >= 0 && (x) <= CAP_LAST_CAP) | ^~ security/commoncap.c:1260:10: note: in expansion of macro ‘cap_valid’ 1260 | if (((!cap_valid(arg3)) | arg4 | arg5)) | ^~~~~~~~~ drivers/video/fbdev/core/fbmon.c: In function ‘get_monspecs’: drivers/video/fbdev/core/fbmon.c:812:47: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body] 812 | DPRINTK(" Configurable signal level\n"); | ^ drivers/video/fbdev/core/fbmon.c:842:24: warning: suggest braces around empty body in an ‘else’ statement [-Wempty-body] 842 | DPRINTK("variable\n"); | ^ drivers/video/fbdev/core/fbmon.c:847:24: warning: suggest braces around empty body in an ‘else’ statement [-Wempty-body] 847 | DPRINTK("variable\n"); | ^ drivers/acpi/scan.c: In function ‘acpi_bus_get_wakeup_device_flags’: drivers/acpi/scan.c:903:43: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body] 903 | "error in _DSW or _PSW evaluation\n")); | ^ drivers/acpi/acpi_processor.c: In function ‘acpi_processor_errata_piix4’: drivers/acpi/acpi_processor.c:133:67: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body] 133 | "Bus master activity detection (BM-IDE) erratum enabled\n")); | ^ drivers/acpi/acpi_processor.c:136:54: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body] 136 | "Type-F DMA livelock erratum (C3 disabled)\n")); | ^ drivers/acpi/acpi_processor.c: In function ‘acpi_processor_get_info’: drivers/acpi/acpi_processor.c:251:49: warning: suggest braces around empty body in an ‘else’ statement [-Wempty-body] 251 | "No bus mastering arbitration control\n")); | ^ drivers/acpi/processor_pdc.c: In function ‘acpi_processor_eval_pdc’: drivers/acpi/processor_pdc.c:136:65: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body] 136 | "Could not evaluate _PDC, using legacy perf. control.\n")); | ^ drivers/tty/vt/keyboard.c: In function ‘k_fn’: drivers/tty/vt/keyboard.c:740:22: warning: comparison is always true due to limited range of data type [-Wtype-limits] 740 | if ((unsigned)value < ARRAY_SIZE(func_table)) { | ^ fs/posix_acl.c: In function ‘get_acl’: fs/posix_acl.c:127:22: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body] 127 | /* fall through */ ; | ^ drivers/scsi/sr.c:691:12: warning: initialized field overwritten [-Woverride-init] 691 | .ioctl = sr_block_compat_ioctl, | ^~~~~~~~~~~~~~~~~~~~~ drivers/scsi/sr.c:691:12: note: (near initialization for ‘sr_bdops.ioctl’) In file included from drivers/ata/ahci.c:35: drivers/ata/ahci.h:384:16: warning: initialized field overwritten [-Woverride-init] 384 | .can_queue = AHCI_MAX_CMDS, \ | ^~~~~~~~~~~~~ drivers/ata/ahci.c:103:2: note: in expansion of macro ‘AHCI_SHT’ 103 | AHCI_SHT("ahci"), | ^~~~~~~~ drivers/ata/ahci.h:384:16: note: (near initialization for ‘ahci_sht.can_queue’) 384 | .can_queue = AHCI_MAX_CMDS, \ | ^~~~~~~~~~~~~ drivers/ata/ahci.c:103:2: note: in expansion of macro ‘AHCI_SHT’ 103 | AHCI_SHT("ahci"), | ^~~~~~~~ drivers/ata/ahci.h:388:17: warning: initialized field overwritten [-Woverride-init] 388 | .sdev_attrs = ahci_sdev_attrs | ^~~~~~~~~~~~~~~ drivers/ata/ahci.c:103:2: note: in expansion of macro ‘AHCI_SHT’ 103 | AHCI_SHT("ahci"), | ^~~~~~~~ drivers/ata/ahci.h:388:17: note: (near initialization for ‘ahci_sht.sdev_attrs’) 388 | .sdev_attrs = ahci_sdev_attrs | ^~~~~~~~~~~~~~~ drivers/ata/ahci.c:103:2: note: in expansion of macro ‘AHCI_SHT’ 103 | AHCI_SHT("ahci"), | ^~~~~~~~ lib/errname.c:15:67: warning: initialized field overwritten [-Woverride-init] 15 | #define E(err) [err + BUILD_BUG_ON_ZERO(err <= 0 || err > 300)] = "-" #err | ^~~ lib/errname.c:172:2: note: in expansion of macro ‘E’ 172 | E(EDEADLK), /* EDEADLOCK */ | ^ lib/errname.c:15:67: note: (near initialization for ‘names_0[35]’) 15 | #define E(err) [err + BUILD_BUG_ON_ZERO(err <= 0 || err > 300)] = "-" #err | ^~~ lib/errname.c:172:2: note: in expansion of macro ‘E’ 172 | E(EDEADLK), /* EDEADLOCK */ | ^ lib/radix-tree.c: In function ‘set_iter_tags’: lib/radix-tree.c:1134:15: warning: comparison is always false due to limited range of data type [-Wtype-limits] 1134 | if (tag_long < RADIX_TREE_TAG_LONGS - 1) { | ^ drivers/input/mouse/synaptics.c: In function ‘synaptics_process_packet’: drivers/input/mouse/synaptics.c:1105:6: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body] 1105 | ; /* Nothing, treat a pen as a single finger */ | ^ drivers/usb/core/sysfs.c: In function ‘usb_create_sysfs_intf_files’: drivers/usb/core/sysfs.c:1266:3: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body] 1266 | ; /* We don't actually care if the function fails. */ | ^ drivers/md/md.c: In function ‘bind_rdev_to_array’: drivers/md/md.c:2438:27: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body] 2438 | /* failure here is OK */; | ^ drivers/md/md.c: In function ‘slot_store’: drivers/md/md.c:3200:28: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body] 3200 | /* failure here is OK */; | ^ drivers/md/md.c: In function ‘remove_and_add_spares’: drivers/md/md.c:9045:29: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body] 9045 | /* failure here is OK */; | ^ drivers/hid/hid-lgff.c: In function ‘hid_lgff_play’: drivers/hid/hid-lgff.c:65:24: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits] 65 | #define CLAMP(x) if (x < 0) x = 0; if (x > 0xff) x = 0xff | ^ drivers/hid/hid-lgff.c:86:3: note: in expansion of macro ‘CLAMP’ 86 | CLAMP(left); | ^~~~~ drivers/hid/hid-lgff.c:65:24: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits] 65 | #define CLAMP(x) if (x < 0) x = 0; if (x > 0xff) x = 0xff | ^ drivers/hid/hid-lgff.c:87:3: note: in expansion of macro ‘CLAMP’ 87 | CLAMP(right); | ^~~~~
| |