On Fri, Nov 26, 2021 at 05:41:20PM +0100, Jan Stary wrote:
> > > Stop building the kernel with -Wno-uninitialized on clang archs.
> > > This hides real problems like the recently fixed uninitialised memory
> > > use in pf and igc.
> > >
> > > [-Wsometimes-uninitialized] /sys/arch/arm/arm/cpu.c:352:6: warning:
> > > variable 'ci' is used uninitialized whenever 'if' condition is false
> > > [-Wsometimes-uninitialized] /sys/arch/arm64/arm64/cpu.c:613:6: warning:
> > > variable 'ci' is used uninitialized whenever 'if' condition is false
> > > [-Wsometimes-uninitialized] /sys/arch/riscv64/riscv64/cpu.c:169:6:
> > > warning: variable 'ci' is used uninitialized whenever 'if' condition is
> > > false
> > > [-Wsometimes-uninitialized]
> > > /tmp/src/sys/arch/powerpc/powerpc/trap.c:467:7: error: variable 'offset'
> > > is used uninitialized whenever 'if' condition is false
> > > [-Wuninitialized] /sys/arch/arm64/dev/acpiiort.c:174:28: warning:
> > > variable 'rid' is uninitialized when used here
> > >
> > > cpu.c warnings occur with MULTIPROCESSOR not defined
> > > powerpc trap.c occurs with DDB not defined
> > >
> > > patch to address these and remove the flag below
> > > acpiiort part from patrick@
>
> On each of the following platforms, the kernel builds fine for me
> with this patch and the compilation shows none of the above warnings.
>
> i386 (ALIX.1E)
> amd64 (Thinkpad T400)
> arm64 (Raspberry Pi 3 and 4)
> armv7 (BeagleBone Black)
> macppc (Mac Mini 7447A)
thanks, committed with the i386 part changed to not remove -Werror
>
>
> Jan
>
> > > Index: arch/amd64/conf/Makefile.amd64
> > > ===================================================================
> > > RCS file: /cvs/src/sys/arch/amd64/conf/Makefile.amd64,v
> > > retrieving revision 1.121
> > > diff -u -p -r1.121 Makefile.amd64
> > > --- arch/amd64/conf/Makefile.amd64 12 Jul 2021 06:07:33 -0000
> > > 1.121
> > > +++ arch/amd64/conf/Makefile.amd64 26 Nov 2021 04:54:10 -0000
> > > @@ -48,7 +48,7 @@ INCLUDES= -nostdinc -I$S -I${.OBJDIR} -I
> > > CPPFLAGS= ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -MD -MP \
> > > -DCONFIG_DRM_AMD_DC_DCN3_0
> > > CWARNFLAGS= -Werror -Wall -Wimplicit-function-declaration \
> > > - -Wno-uninitialized -Wno-pointer-sign \
> > > + -Wno-pointer-sign \
> > > -Wframe-larger-than=2047
> > >
> > > CMACHFLAGS= -mcmodel=kernel -mno-red-zone -mno-sse2 -mno-sse
> > > -mno-3dnow \
> > > Index: arch/arm/arm/cpu.c
> > > ===================================================================
> > > RCS file: /cvs/src/sys/arch/arm/arm/cpu.c,v
> > > retrieving revision 1.55
> > > diff -u -p -r1.55 cpu.c
> > > --- arch/arm/arm/cpu.c 25 Mar 2021 04:12:00 -0000 1.55
> > > +++ arch/arm/arm/cpu.c 23 Nov 2021 00:19:43 -0000
> > > @@ -349,14 +349,11 @@ cpu_attach(struct device *parent, struct
> > > __asm volatile("mrc p15, 0, %0, c0, c0, 5" : "=r"(mpidr));
> > > KASSERT(faa->fa_nreg > 0);
> > >
> > > +#ifdef MULTIPROCESSOR
> > > if (faa->fa_reg[0].addr == (mpidr & MPIDR_AFF)) {
> > > ci = &cpu_info_primary;
> > > -#ifdef MULTIPROCESSOR
> > > ci->ci_flags |= CPUF_RUNNING | CPUF_PRESENT | CPUF_PRIMARY;
> > > -#endif
> > > - }
> > > -#ifdef MULTIPROCESSOR
> > > - else {
> > > + } else {
> > > ci = malloc(sizeof(*ci), M_DEVBUF, M_WAITOK | M_ZERO);
> > > cpu_info[dev->dv_unit] = ci;
> > > ci->ci_next = cpu_info_list->ci_next;
> > > @@ -364,6 +361,8 @@ cpu_attach(struct device *parent, struct
> > > ci->ci_flags |= CPUF_AP;
> > > ncpus++;
> > > }
> > > +#else
> > > + ci = &cpu_info_primary;
> > > #endif
> > >
> > > ci->ci_dev = dev;
> > > Index: arch/arm64/arm64/cpu.c
> > > ===================================================================
> > > RCS file: /cvs/src/sys/arch/arm64/arm64/cpu.c,v
> > > retrieving revision 1.58
> > > diff -u -p -r1.58 cpu.c
> > > --- arch/arm64/arm64/cpu.c 23 Nov 2021 01:03:35 -0000 1.58
> > > +++ arch/arm64/arm64/cpu.c 23 Nov 2021 01:28:26 -0000
> > > @@ -604,20 +604,19 @@ cpu_attach(struct device *parent, struct
> > > {
> > > struct fdt_attach_args *faa = aux;
> > > struct cpu_info *ci;
> > > +#ifdef MULTIPROCESSOR
> > > uint64_t mpidr = READ_SPECIALREG(mpidr_el1);
> > > +#endif
> > > uint64_t id_aa64mmfr1, sctlr;
> > > uint32_t opp;
> > >
> > > KASSERT(faa->fa_nreg > 0);
> > >
> > > +#ifdef MULTIPROCESSOR
> > > if (faa->fa_reg[0].addr == (mpidr & MPIDR_AFF)) {
> > > ci = &cpu_info_primary;
> > > -#ifdef MULTIPROCESSOR
> > > ci->ci_flags |= CPUF_RUNNING | CPUF_PRESENT | CPUF_PRIMARY;
> > > -#endif
> > > - }
> > > -#ifdef MULTIPROCESSOR
> > > - else {
> > > + } else {
> > > ci = malloc(sizeof(*ci), M_DEVBUF, M_WAITOK | M_ZERO);
> > > cpu_info[dev->dv_unit] = ci;
> > > ci->ci_next = cpu_info_list->ci_next;
> > > @@ -625,6 +624,8 @@ cpu_attach(struct device *parent, struct
> > > ci->ci_flags |= CPUF_AP;
> > > ncpus++;
> > > }
> > > +#else
> > > + ci = &cpu_info_primary;
> > > #endif
> > >
> > > ci->ci_dev = dev;
> > > Index: arch/arm64/conf/Makefile.arm64
> > > ===================================================================
> > > RCS file: /cvs/src/sys/arch/arm64/conf/Makefile.arm64,v
> > > retrieving revision 1.39
> > > diff -u -p -r1.39 Makefile.arm64
> > > --- arch/arm64/conf/Makefile.arm64 7 Jul 2021 02:38:21 -0000
> > > 1.39
> > > +++ arch/arm64/conf/Makefile.arm64 26 Nov 2021 04:55:52 -0000
> > > @@ -46,7 +46,7 @@ INCLUDES= -nostdinc -I$S -I${.OBJDIR} -I
> > > -I$S/dev/pci/drm/amd/display/dmub/inc
> > > CPPFLAGS= ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -D__${_mach}__
> > > -MD -MP
> > > CWARNFLAGS= -Werror -Wall -Wimplicit-function-declaration \
> > > - -Wno-uninitialized -Wno-pointer-sign \
> > > + -Wno-pointer-sign \
> > > -Wno-constant-conversion -Wno-address-of-packed-member \
> > > -Wframe-larger-than=2047
> > >
> > > Index: arch/arm64/dev/acpiiort.c
> > > ===================================================================
> > > RCS file: /cvs/src/sys/arch/arm64/dev/acpiiort.c,v
> > > retrieving revision 1.4
> > > diff -u -p -r1.4 acpiiort.c
> > > --- arch/arm64/dev/acpiiort.c 25 Jun 2021 17:41:22 -0000 1.4
> > > +++ arch/arm64/dev/acpiiort.c 26 Nov 2021 05:02:21 -0000
> > > @@ -169,13 +169,6 @@ acpiiort_device_map(struct aml_node *roo
> > > rid = map[i].output_base;
> > > break;
> > > }
> > > -
> > > - /* Mapping encodes number of IDs in the range minus one. */
> > > - if (map[i].input_base <= rid &&
> > > - rid <= map[i].input_base + map[i].number_of_ids) {
> > > - rid = map[i].output_base + (rid - map[i].input_base);
> > > - break;
> > > - }
> > > }
> > >
> > > /* No mapping found? Even weirder. */
> > > Index: arch/armv7/conf/Makefile.armv7
> > > ===================================================================
> > > RCS file: /cvs/src/sys/arch/armv7/conf/Makefile.armv7,v
> > > retrieving revision 1.50
> > > diff -u -p -r1.50 Makefile.armv7
> > > --- arch/armv7/conf/Makefile.armv7 16 May 2021 02:01:33 -0000
> > > 1.50
> > > +++ arch/armv7/conf/Makefile.armv7 26 Nov 2021 04:55:07 -0000
> > > @@ -24,7 +24,7 @@ _archdir?= $S/arch/${_arch}
> > > INCLUDES= -nostdinc -I$S -I. -I$S/arch
> > > CPPFLAGS= ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -D__${_mach}__
> > > -MD -MP
> > > CWARNFLAGS= -Werror -Wall -Wimplicit-function-declaration \
> > > - -Wno-uninitialized -Wno-pointer-sign \
> > > + -Wno-pointer-sign \
> > > -Wno-constant-conversion -Wno-address-of-packed-member \
> > > -Wframe-larger-than=2047
> > >
> > > Index: arch/i386/conf/Makefile.i386
> > > ===================================================================
> > > RCS file: /cvs/src/sys/arch/i386/conf/Makefile.i386,v
> > > retrieving revision 1.140
> > > diff -u -p -r1.140 Makefile.i386
> > > --- arch/i386/conf/Makefile.i386 28 Jan 2021 17:39:03 -0000 1.140
> > > +++ arch/i386/conf/Makefile.i386 26 Nov 2021 04:56:08 -0000
> > > @@ -26,8 +26,8 @@ INCLUDES= -nostdinc -I$S -I${.OBJDIR} -I
> > > -I$S/dev/pci/drm/include/uapi \
> > > -I$S/dev/pci/drm/i915
> > > CPPFLAGS= ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -MD -MP
> > > -CWARNFLAGS= -Werror -Wall -Wimplicit-function-declaration \
> > > - -Wno-uninitialized -Wno-pointer-sign \
> > > +CWARNFLAGS= -Wall -Wimplicit-function-declaration \
> > > + -Wno-pointer-sign \
> > > -Wframe-larger-than=2047
> > >
> > > CMACHFLAGS=
> > > Index: arch/loongson/conf/Makefile.loongson
> > > ===================================================================
> > > RCS file: /cvs/src/sys/arch/loongson/conf/Makefile.loongson,v
> > > retrieving revision 1.80
> > > diff -u -p -r1.80 Makefile.loongson
> > > --- arch/loongson/conf/Makefile.loongson 28 Jan 2021 17:39:03 -0000
> > > 1.80
> > > +++ arch/loongson/conf/Makefile.loongson 26 Nov 2021 04:57:20 -0000
> > > @@ -33,7 +33,7 @@ INCLUDES= -nostdinc -I$S -I${.OBJDIR} -I
> > > -I$S/dev/pci/drm/include/uapi
> > > CPPFLAGS= ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -D__${_mach}__
> > > -MD -MP
> > > CWARNFLAGS= -Werror -Wall -Wimplicit-function-declaration \
> > > - -Wno-uninitialized -Wno-pointer-sign \
> > > + -Wno-pointer-sign \
> > > -Wframe-larger-than=2047
> > >
> > > CMACHFLAGS= -mno-abicalls ${ABI} -msoft-float
> > > -Wa,-mfix-loongson2f-btb -G 0
> > > Index: arch/macppc/conf/Makefile.macppc
> > > ===================================================================
> > > RCS file: /cvs/src/sys/arch/macppc/conf/Makefile.macppc,v
> > > retrieving revision 1.102
> > > diff -u -p -r1.102 Makefile.macppc
> > > --- arch/macppc/conf/Makefile.macppc 10 May 2021 17:29:41 -0000
> > > 1.102
> > > +++ arch/macppc/conf/Makefile.macppc 26 Nov 2021 04:58:37 -0000
> > > @@ -26,7 +26,7 @@ INCLUDES= -nostdinc -I$S -I${.OBJDIR} -I
> > > -I$S/dev/pci/drm/include/uapi
> > > CPPFLAGS= ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -D__${_mach}__
> > > -MD -MP
> > > CWARNFLAGS= -Werror -Wall -Wimplicit-function-declaration \
> > > - -Wno-main -Wno-uninitialized -Wno-pointer-sign \
> > > + -Wno-main -Wno-pointer-sign \
> > > -Wframe-larger-than=2047
> > >
> > > CMACHFLAGS= -msoft-float
> > > Index: arch/octeon/conf/Makefile.octeon
> > > ===================================================================
> > > RCS file: /cvs/src/sys/arch/octeon/conf/Makefile.octeon,v
> > > retrieving revision 1.58
> > > diff -u -p -r1.58 Makefile.octeon
> > > --- arch/octeon/conf/Makefile.octeon 6 Feb 2021 09:31:47 -0000
> > > 1.58
> > > +++ arch/octeon/conf/Makefile.octeon 26 Nov 2021 04:57:30 -0000
> > > @@ -31,7 +31,7 @@ _archdir?= $S/arch/${_arch}
> > > INCLUDES= -nostdinc -I$S -I${.OBJDIR} -I$S/arch
> > > CPPFLAGS= ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -D__${_mach}__
> > > -MD -MP
> > > CWARNFLAGS= -Werror -Wall -Wimplicit-function-declaration \
> > > - -Wno-uninitialized -Wno-pointer-sign \
> > > + -Wno-pointer-sign \
> > > -Wframe-larger-than=2047
> > >
> > > CMACHFLAGS= -mno-abicalls ${ABI} -msoft-float -G 0
> > > Index: arch/powerpc/powerpc/trap.c
> > > ===================================================================
> > > RCS file: /cvs/src/sys/arch/powerpc/powerpc/trap.c,v
> > > retrieving revision 1.121
> > > diff -u -p -r1.121 trap.c
> > > --- arch/powerpc/powerpc/trap.c 20 May 2021 12:34:35 -0000 1.121
> > > +++ arch/powerpc/powerpc/trap.c 23 Nov 2021 00:42:09 -0000
> > > @@ -461,13 +461,14 @@ brain_damage:
> > > /* set up registers */
> > > db_save_regs(frame);
> > > db_find_sym_and_offset(frame->srr0, &name, &offset);
> > > -#else
> > > - name = NULL;
> > > -#endif
> > > if (!name) {
> > > name = "0";
> > > offset = frame->srr0;
> > > }
> > > +#else
> > > + name = "0";
> > > + offset = frame->srr0;
> > > +#endif
> > > panic("trap type %x srr1 %x at %x (%s+0x%lx) lr %lx",
> > > type, frame->srr1, frame->srr0, name, offset, frame->lr);
> > >
> > > Index: arch/powerpc64/conf/Makefile.powerpc64
> > > ===================================================================
> > > RCS file: /cvs/src/sys/arch/powerpc64/conf/Makefile.powerpc64,v
> > > retrieving revision 1.10
> > > diff -u -p -r1.10 Makefile.powerpc64
> > > --- arch/powerpc64/conf/Makefile.powerpc64 7 Jul 2021 02:38:21
> > > -0000 1.10
> > > +++ arch/powerpc64/conf/Makefile.powerpc64 26 Nov 2021 04:59:19
> > > -0000
> > > @@ -46,7 +46,7 @@ INCLUDES= -nostdinc -I$S -I${.OBJDIR} -I
> > > -I$S/dev/pci/drm/amd/display/dmub/inc
> > > CPPFLAGS= ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -MD -MP
> > > CWARNFLAGS= -Werror -Wall -Wimplicit-function-declaration \
> > > - -Wno-uninitialized -Wno-pointer-sign \
> > > + -Wno-pointer-sign \
> > > -Wno-constant-conversion -Wno-address-of-packed-member \
> > > -Wframe-larger-than=2047
> > >
> > > Index: arch/riscv64/conf/Makefile.riscv64
> > > ===================================================================
> > > RCS file: /cvs/src/sys/arch/riscv64/conf/Makefile.riscv64,v
> > > retrieving revision 1.12
> > > diff -u -p -r1.12 Makefile.riscv64
> > > --- arch/riscv64/conf/Makefile.riscv64 29 Jun 2021 18:45:41 -0000
> > > 1.12
> > > +++ arch/riscv64/conf/Makefile.riscv64 26 Nov 2021 04:59:28 -0000
> > > @@ -26,7 +26,7 @@ INCLUDES= -nostdinc -I$S -I${.OBJDIR} -I
> > > -I$S/dev/pci/drm/include/uapi
> > > CPPFLAGS= ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -D__${_mach}__
> > > -MD -MP
> > > CWARNFLAGS= -Werror -Wall -Wimplicit-function-declaration \
> > > - -Wno-uninitialized -Wno-pointer-sign \
> > > + -Wno-pointer-sign \
> > > -Wno-constant-conversion -Wno-address-of-packed-member \
> > > -Wframe-larger-than=2047
> > >
> > > Index: arch/riscv64/riscv64/cpu.c
> > > ===================================================================
> > > RCS file: /cvs/src/sys/arch/riscv64/riscv64/cpu.c,v
> > > retrieving revision 1.11
> > > diff -u -p -r1.11 cpu.c
> > > --- arch/riscv64/riscv64/cpu.c 24 Jul 2021 18:15:13 -0000 1.11
> > > +++ arch/riscv64/riscv64/cpu.c 23 Nov 2021 00:21:26 -0000
> > > @@ -166,15 +166,12 @@ cpu_attach(struct device *parent, struct
> > >
> > > KASSERT(faa->fa_nreg > 0);
> > >
> > > +#ifdef MULTIPROCESSOR
> > > if (faa->fa_reg[0].addr == boot_hart) {
> > > ci = &cpu_info_primary;
> > > -#ifdef MULTIPROCESSOR
> > > ci->ci_flags |= CPUF_RUNNING | CPUF_PRESENT | CPUF_PRIMARY;
> > > csr_set(sie, SIE_SSIE);
> > > -#endif
> > > - }
> > > -#ifdef MULTIPROCESSOR
> > > - else {
> > > + } else {
> > > ci = malloc(sizeof(*ci), M_DEVBUF, M_WAITOK | M_ZERO);
> > > cpu_info[dev->dv_unit] = ci;
> > > ci->ci_next = cpu_info_list->ci_next;
> > > @@ -182,6 +179,8 @@ cpu_attach(struct device *parent, struct
> > > ci->ci_flags |= CPUF_AP;
> > > ncpus++;
> > > }
> > > +#else
> > > + ci = &cpu_info_primary;
> > > #endif
> > >
> > > ci->ci_dev = dev;
> > >
> > >
> >
> >
>
>