New warnings with gcc9

From: Laura Abbott
Date: Wed Jan 23 2019 - 10:25:42 EST


As an FYI for anyone who is interested, gcc9 landed in Fedora rawhide
and I built the kernel as usual.

There's a very large number of warnings from -Waddress-of-packed-member e.g.

BUILDSTDERR: drivers/scsi/ipr.c: In function 'ipr_handle_config_change':
BUILDSTDERR: drivers/scsi/ipr.c:1453:22: warning: taking address of packed member of 'struct ipr_hostrcb_cfg_ch_not' may result in an unaligned pointer value [-Waddress-of-packed-member]
BUILDSTDERR: 1453 | cfgtew.u.cfgte64 = &hostrcb->hcam.u.ccn.u.cfgte64;
BUILDSTDERR: |

There's also some missing attribute warnings. The majority are caused by a
missing attribute in module_init/module_exit

BUILDSTDERR: In file included from drivers/scsi/hptiop.c:18:
BUILDSTDERR: ./include/linux/module.h:132:6: warning: 'init_module' specifies less restrictive attribute than its target 'hptiop_module_init': 'cold' [-Wmissing-attributes]
BUILDSTDERR: 132 | int init_module(void) __attribute__((alias(#initfn)));
BUILDSTDERR: | ^~~~~~~~~~~
BUILDSTDERR: drivers/scsi/hptiop.c:1704:1: note: in expansion of macro 'module_init'
BUILDSTDERR: 1704 | module_init(hptiop_module_init);
BUILDSTDERR: | ^~~~~~~~~~~
BUILDSTDERR: drivers/scsi/hptiop.c:1692:19: note: 'init_module' target declared here
BUILDSTDERR: 1692 | static int __init hptiop_module_init(void)
BUILDSTDERR: |

I also hit a build failure on s390, This looks to be an issue with the assembly,
I'm in discussion with the s390 people about the proper fix.

BUILDSTDERR: ./arch/s390/include/asm/jump_label.h: Assembler messages:
BUILDSTDERR: ./arch/s390/include/asm/jump_label.h:23: Error: bad expression
BUILDSTDERR: ./arch/s390/include/asm/jump_label.h:23: Error: junk at end of line, first unrecognized character is `r'
BUILDSTDERR: make[1]: *** [scripts/Makefile.build:277: init/main.o] Error 1


This looks like a new warning due to hvclock_page being declared
u8 and then cast to a struct

BUILDSTDERR: arch/x86/entry/vdso/vclock_gettime.c: In function 'do_hres':
BUILDSTDERR: ./include/linux/compiler.h:182:26: warning: array subscript 1 is outside array bounds of 'u8[1]' {aka 'unsigned char[1]'} [-Warray-bounds]
BUILDSTDERR: 182 | case 8: *(__u64 *)res = *(volatile __u64 *)p; break; \
BUILDSTDERR: | ^~~~~~~~~~~~~~~~~~~~
BUILDSTDERR: ./include/linux/compiler.h:193:2: note: in expansion of macro '__READ_ONCE_SIZE'
BUILDSTDERR: 193 | __READ_ONCE_SIZE;
BUILDSTDERR: | ^~~~~~~~~~~~~~~~
BUILDSTDERR: arch/x86/entry/vdso/vclock_gettime.c:37:11: note: while referencing 'hvclock_page'
BUILDSTDERR: 37 | extern u8 hvclock_page
BUILDSTDERR: | ^~~~~~~~~~~~

This looks like we just need to make the attributes match

BUILDSTDERR: lib/crc32.c:209:5: warning: 'crc32_le_base' specifies less restrictive attribute than its target 'crc32_le': 'pure' [-Wmissing-attributes]
BUILDSTDERR: 209 | u32 crc32_le_base(u32, unsigned char const *, size_t) __alias(crc32_le);
BUILDSTDERR: | ^~~~~~~~~~~~~
BUILDSTDERR: lib/crc32.c:195:19: note: 'crc32_le_base' target declared here
BUILDSTDERR: 195 | u32 __pure __weak crc32_le(u32 crc, unsigned char const *p, size_t len)
BUILDSTDERR: | ^~~~~~~~
BUILDSTDERR: lib/crc32.c:210:5: warning: '__crc32c_le_base' specifies less restrictive attribute than its target '__crc32c_le': 'pure' [-Wmissing-attributes]
BUILDSTDERR: 210 | u32 __crc32c_le_base(u32, unsigned char const *, size_t) __alias(__crc32c_le);
BUILDSTDERR: | ^~~~~~~~~~~~~~~~
BUILDSTDERR: lib/crc32.c:200:19: note: '__crc32c_le_base' target declared here
BUILDSTDERR: 200 | u32 __pure __weak __crc32c_le(u32 crc, unsigned char const *p, size_t len)
BUILDSTDERR: |

I think this is a corner case in the code flow so it should
be fixed up

BUILDSTDERR: drivers/i2c/i2c-core-base.c: In function 'i2c_generic_scl_recovery':
BUILDSTDERR: drivers/i2c/i2c-core-base.c:235:5: warning: 'ret' may be used uninitialized in this function [-Wmaybe-uninitialized]
BUILDSTDERR: 235 | if (ret == -EOPNOTSUPP)
BUILDSTDERR: | ^


There's also a bunch of warnings from -Wpragma that show up on powerpc and arm32

BUILDSTDERR: In file included from ././include/linux/compiler_types.h:68,
BUILDSTDERR: from <command-line>:
BUILDSTDERR: ./include/linux/compiler-gcc.h:166:20: warning: unknown option after '#pragma GCC diagnostic' kind [-Wpragmas]
BUILDSTDERR: 166 | #define __diag(s) _Pragma(__diag_str(GCC diagnostic s))
BUILDSTDERR: | ^~~~~~~
BUILDSTDERR: ./include/linux/compiler-gcc.h:169:26: note: in expansion of macro '__diag'
BUILDSTDERR: 169 | #define __diag_GCC_8(s) __diag(s)
BUILDSTDERR: | ^~~~~~
BUILDSTDERR: ./include/linux/compiler-gcc.h:157:2: note: in expansion of macro '__diag_GCC_8'
BUILDSTDERR: 157 | __diag_GCC_ ## version(__diag_GCC_ ## severity s)
BUILDSTDERR: | ^~~~~~~~~~~
BUILDSTDERR: ././include/linux/compiler_types.h:212:2: note: in expansion of macro '__diag_GCC'
BUILDSTDERR: 212 | __diag_ ## compiler(version, ignore, option)
BUILDSTDERR: | ^~~~~~~
BUILDSTDERR: ./include/linux/syscalls.h:237:2: note: in expansion of macro '__diag_ignore'
BUILDSTDERR: 237 | __diag_ignore(GCC, 8, "-Wattribute-alias", \
BUILDSTDERR: | ^~~~~~~~~~~~~
BUILDSTDERR: ./include/linux/syscalls.h:225:2: note: in expansion of macro '__SYSCALL_DEFINEx'
BUILDSTDERR: 225 | __SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
BUILDSTDERR: | ^~~~~~~~~~~~~~~~~
BUILDSTDERR: ./include/linux/syscalls.h:216:36: note: in expansion of macro 'SYSCALL_DEFINEx'
BUILDSTDERR: 216 | #define SYSCALL_DEFINE3(name, ...) SYSCALL_DEFINEx(3, _##name, __VA_ARGS__)
BUILDSTDERR: | ^~~~~~~~~~~~~~~
BUILDSTDERR: kernel/bpf/syscall.c:2580:1: note: in expansion of macro 'SYSCALL_DEFINE3'
BUILDSTDERR: 2580 | SYSCALL_DEFINE3(bpf, int, cmd, union bpf_attr __user *, uattr, unsigned int, size)
BUILDSTDERR: | ^~~~~~~~~~~~~~~


I'll see about fixing these up if someone doesn't get to them first.

Thanks,
Laura