Skip to contentSkip to conversation

Makefile: Globally enable fall-through warning

PATCH Guenter Roeck 3 participants 7 messages Jul 28, 2019 – Jul 29, 2019

lore
Share & tools
lore
#0 lore raw
Quoted 3 lines · Gustavo A. R. Silva

Now that all the fall-through warnings have been addressed in the kernel, enable the fall-through warning globally.

Not really "all".

powerpc:85xx/sbc8548_defconfig:

arch/powerpc/kernel/align.c: In function ‘emulate_spe’:
arch/powerpc/kernel/align.c:178:8: error: this statement may fall through

Plus many more similar errors in the same file.

All sh builds:

arch/sh/kernel/disassemble.c: In function 'print_sh_insn':
arch/sh/kernel/disassemble.c:478:8: error: this statement may fall through

Again, this is seen in several places.

mips:cavium_octeon_defconfig:

arch/mips/cavium-octeon/octeon-usb.c: In function 'dwc3_octeon_clocks_start':
include/linux/device.h:1499:2: error: this statement may fall through

None of those are from recent changes. And this is just from my small subset of test builds.

Guenter

#1 lore raw

Hi Guenter,

Quoted 21 lines · Guenter Roeck
Quoted 3 lines · Gustavo A. R. Silva

Now that all the fall-through warnings have been addressed in the kernel, enable the fall-through warning globally.

Not really "all".

powerpc:85xx/sbc8548_defconfig:

arch/powerpc/kernel/align.c: In function ‘emulate_spe’:
arch/powerpc/kernel/align.c:178:8: error: this statement may fall through

Plus many more similar errors in the same file.

All sh builds:

arch/sh/kernel/disassemble.c: In function 'print_sh_insn':
arch/sh/kernel/disassemble.c:478:8: error: this statement may fall through

Again, this is seen in several places.

Quoted 8 lines

mips:cavium_octeon_defconfig:

arch/mips/cavium-octeon/octeon-usb.c: In function 'dwc3_octeon_clocks_start':
include/linux/device.h:1499:2: error: this statement may fall through

None of those are from recent changes. And this is just from my small subset of test builds.

Thank you for letting me know about this. I don't have access to build infrastructure like yours.

My build infrastructure is similar to that of Linus.

But if you send me all of those I can create a patch and send it back to you to make sure what you see is addressed. If we can coordinate for this it'd be great for everybody. :)

Thanks
--
Gustavo

#2 lore raw

Hi Gustavo,

Quoted 29 lines · Gustavo A. R. Silva

Hi Guenter,

Quoted 26 lines · Guenter Roeck
Quoted 3 lines · Gustavo A. R. Silva

Now that all the fall-through warnings have been addressed in the kernel, enable the fall-through warning globally.

Not really "all".

powerpc:85xx/sbc8548_defconfig:

arch/powerpc/kernel/align.c: In function ‘emulate_spe’:
arch/powerpc/kernel/align.c:178:8: error: this statement may fall through

Plus many more similar errors in the same file.

All sh builds:

arch/sh/kernel/disassemble.c: In function 'print_sh_insn':
arch/sh/kernel/disassemble.c:478:8: error: this statement may fall through

Again, this is seen in several places.

mips:cavium_octeon_defconfig:

arch/mips/cavium-octeon/octeon-usb.c: In function 'dwc3_octeon_clocks_start':
include/linux/device.h:1499:2: error: this statement may fall through

Quoted 7 lines
Quoted 3 lines

None of those are from recent changes. And this is just from my small subset of test builds.

Thank you for letting me know about this. I don't have access to build infrastructure like yours.

I am always happy to run test builds on my infrastructure.

Quoted 6 lines

My build infrastructure is similar to that of Linus.

But if you send me all of those I can create a patch and send it back to you to make sure what you see is addressed. If we can coordinate for this it'd be great for everybody. :)

Just have a look at the output of https://kerneltests.org/builders/,
in the 'master' and/or 'next' column. There are many additional warnings in 'next'. Only downside is that you won't see the warnings unless there are also build errors, but -next tends to have lots of those.

Just wondering ... wouldn't it be possible to run a coccinelle script to identify those problems automatically, without depending on compile warnings ? Or smatch/sparse, maybe ?

Thanks,
Guenter

#3 lore raw
Quoted 36 lines · Guenter Roeck

Hi Gustavo,

Quoted 33 lines · Gustavo A. R. Silva

Hi Guenter,

Quoted 29 lines · Guenter Roeck
Quoted 3 lines · Gustavo A. R. Silva

Now that all the fall-through warnings have been addressed in the kernel, enable the fall-through warning globally.

Not really "all".

powerpc:85xx/sbc8548_defconfig:

arch/powerpc/kernel/align.c: In function ‘emulate_spe’:
arch/powerpc/kernel/align.c:178:8: error: this statement may fall through

Plus many more similar errors in the same file.

All sh builds:

arch/sh/kernel/disassemble.c: In function 'print_sh_insn':
arch/sh/kernel/disassemble.c:478:8: error: this statement may fall through

Again, this is seen in several places.

mips:cavium_octeon_defconfig:

arch/mips/cavium-octeon/octeon-usb.c: In function 'dwc3_octeon_clocks_start':
include/linux/device.h:1499:2: error: this statement may fall through

None of those are from recent changes. And this is just from my small subset of test builds.

Quoted 6 lines
Quoted 3 lines

Thank you for letting me know about this. I don't have access to build infrastructure like yours.

I am always happy to run test builds on my infrastructure.

Thank you!

Quoted 7 lines
Quoted 6 lines

My build infrastructure is similar to that of Linus.

But if you send me all of those I can create a patch and send it back to you to make sure what you see is addressed. If we can coordinate for this it'd be great for everybody. :)

Quoted 5 lines

Just have a look at the output of https://kerneltests.org/builders/,
in the 'master' and/or 'next' column. There are many additional warnings in 'next'. Only downside is that you won't see the warnings unless there are also build errors, but -next tends to have lots of those.

I see.

mm... for some reason I'm not able to establish connection with that site...

Quoted 4 lines

Just wondering ... wouldn't it be possible to run a coccinelle script to identify those problems automatically, without depending on compile warnings ? Or smatch/sparse, maybe ?

That was a common question from people along the whole process. The short answer is: no. The reason for that is that Coccinelle is not a sophisticated enough tool to determine if we are dealing with a false positive or an actual bug.

That's why a code audit was needed.

Thanks
--
Gustavo

#4 lore raw
Quoted 61 lines · Gustavo A. R. Silva
Quoted 36 lines · Guenter Roeck

Hi Gustavo,

Quoted 33 lines · Gustavo A. R. Silva

Hi Guenter,

Quoted 29 lines · Guenter Roeck
Quoted 3 lines · Gustavo A. R. Silva

Now that all the fall-through warnings have been addressed in the kernel, enable the fall-through warning globally.

Not really "all".

powerpc:85xx/sbc8548_defconfig:

arch/powerpc/kernel/align.c: In function ‘emulate_spe’:
arch/powerpc/kernel/align.c:178:8: error: this statement may fall through

Plus many more similar errors in the same file.

All sh builds:

arch/sh/kernel/disassemble.c: In function 'print_sh_insn':
arch/sh/kernel/disassemble.c:478:8: error: this statement may fall through

Again, this is seen in several places.

mips:cavium_octeon_defconfig:

arch/mips/cavium-octeon/octeon-usb.c: In function 'dwc3_octeon_clocks_start':
include/linux/device.h:1499:2: error: this statement may fall through

None of those are from recent changes. And this is just from my small subset of test builds.

Quoted 6 lines
Quoted 3 lines

Thank you for letting me know about this. I don't have access to build infrastructure like yours.

I am always happy to run test builds on my infrastructure.

Thank you!

Quoted 7 lines
Quoted 6 lines

My build infrastructure is similar to that of Linus.

But if you send me all of those I can create a patch and send it back to you to make sure what you see is addressed. If we can coordinate for this it'd be great for everybody. :)

Quoted 5 lines

Just have a look at the output of https://kerneltests.org/builders/,
in the 'master' and/or 'next' column. There are many additional warnings in 'next'. Only downside is that you won't see the warnings unless there are also build errors, but -next tends to have lots of those.

Quoted 4 lines

I see.

mm... for some reason I'm not able to establish connection with that site...

What is your host's IP address ? It might be auto-filtered; the site is hosted on my own server and is under constant attack. Any subnet originating a sequence of attacks will be blocked automatically.

Thanks,
Guenter

Quoted 21 lines
Quoted 4 lines

Just wondering ... wouldn't it be possible to run a coccinelle script to identify those problems automatically, without depending on compile warnings ? Or smatch/sparse, maybe ?

That was a common question from people along the whole process. The short answer is: no. The reason for that is that Coccinelle is not a sophisticated enough tool to determine if we are dealing with a false positive or an actual bug.

That's why a code audit was needed.

Thanks
--
Gustavo

#5 lore raw
In reply to Gustavo A. R. Silva

Hi Gustavo,

Quoted 31 lines · Gustavo A. R. Silva
Quoted 21 lines · Guenter Roeck
Quoted 3 lines · Gustavo A. R. Silva

Now that all the fall-through warnings have been addressed in the kernel, enable the fall-through warning globally.

Not really "all".

powerpc:85xx/sbc8548_defconfig:

arch/powerpc/kernel/align.c: In function ‘emulate_spe’:
arch/powerpc/kernel/align.c:178:8: error: this statement may fall through

Plus many more similar errors in the same file.

All sh builds:

arch/sh/kernel/disassemble.c: In function 'print_sh_insn':
arch/sh/kernel/disassemble.c:478:8: error: this statement may fall through

Again, this is seen in several places.

Quoted 8 lines

mips:cavium_octeon_defconfig:

arch/mips/cavium-octeon/octeon-usb.c: In function 'dwc3_octeon_clocks_start':
include/linux/device.h:1499:2: error: this statement may fall through

None of those are from recent changes. And this is just from my small subset of test builds.

Quoted 9 lines

Thank you for letting me know about this. I don't have access to build infrastructure like yours.

My build infrastructure is similar to that of Linus.

But if you send me all of those I can create a patch and send it back to you to make sure what you see is addressed. If we can coordinate for this it'd be great for everybody. :)

More to be found in
https://lore.kernel.org/lkml/[email protected]/

and I saw the following in my local builds (not detected above due to kisskb using an older compiler for m68k builds):

arch/m68k/include/asm/amigahw.h: warning: this statement may fall through [-Wimplicit-fallthrough=]: => 42:50 drivers/block/ataflop.c: warning: this statement may fall through [-Wimplicit-fallthrough=]: => 1728:3 drivers/net/arcnet/com20020-isa.c: warning: this statement may fall through [-Wimplicit-fallthrough=]: => 205:13, 203:10, 209:7, 201:11, 207:8
drivers/scsi/sun3_scsi.c: warning: this statement may fall through [-Wimplicit-fallthrough=]: => 399:9, 403:9 sound/oss/dmasound/dmasound_atari.c: warning: this statement may fall through [-Wimplicit-fallthrough=]: => 1449:24

Thanks for fixing ;-)

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
#6 lore raw

Hi Geert,

Quoted 4 lines · Geert Uytterhoeven

More to be found in
https://lore.kernel.org/lkml/[email protected]/

I already sent out patches for many of those. :)

Thanks a lot!

Quoted 15 lines

and I saw the following in my local builds (not detected above due to kisskb using an older compiler for m68k builds):

arch/m68k/include/asm/amigahw.h: warning: this statement may fall through [-Wimplicit-fallthrough=]: => 42:50 drivers/block/ataflop.c: warning: this statement may fall through [-Wimplicit-fallthrough=]: => 1728:3 drivers/net/arcnet/com20020-isa.c: warning: this statement may fall through [-Wimplicit-fallthrough=]: => 205:13, 203:10, 209:7, 201:11, 207:8
drivers/scsi/sun3_scsi.c: warning: this statement may fall through [-Wimplicit-fallthrough=]: => 399:9, 403:9 sound/oss/dmasound/dmasound_atari.c: warning: this statement may fall through [-Wimplicit-fallthrough=]: => 1449:24

I already sent patches for some of the ones above, too. Although, I have some doubts with the one at arch/m68k/amiga/config.c:223

We can talk about it in a separate thread.

Quoted 2 lines

Thanks for fixing ;-)

Glad to help. :)

Thanks
--
Gustavo