All of lore.kernel.org
 help / color / mirror / Atom feed
* [GIT PULL] fallthrough fixes for Clang for 5.17-rc1
@ 2022-01-11 19:14 Gustavo A. R. Silva
  2022-01-12  1:02 ` Linus Torvalds
  0 siblings, 1 reply; 2+ messages in thread
From: Gustavo A. R. Silva @ 2022-01-11 19:14 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Kees Cook, linux-hardening, linux-kernel, Gustavo A. R. Silva

The following changes since commit 136057256686de39cc3a07c2e39ef6bc43003ff6:

  Linux 5.16-rc2 (2021-11-21 13:47:39 -0800)

are available in the Git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git tags/fallthrough-fixes-clang-5.17-rc1

for you to fetch changes up to ceec16f8fd660c7827e72aec74021f1acc1f7240:

  fbdev: sh7760fb: document fallthrough cases (2021-11-22 18:43:20 -0600)

----------------------------------------------------------------
fallthrough fixes for Clang for 5.17-rc1

Hi Linus,

Please, pull the following patches that fix some fall-through warnings
when building with Clang and -Wimplicit-fallthrough.

Thanks!
--
Gustavo

----------------------------------------------------------------
Gustavo A. R. Silva (1):
      MIPS: mm: tlbex: Fix fall-through warning for Clang

Randy Dunlap (1):
      fbdev: sh7760fb: document fallthrough cases

 arch/mips/mm/tlbex.c           | 1 +
 drivers/video/fbdev/sh7760fb.c | 2 ++
 2 files changed, 3 insertions(+)

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [GIT PULL] fallthrough fixes for Clang for 5.17-rc1
  2022-01-11 19:14 [GIT PULL] fallthrough fixes for Clang for 5.17-rc1 Gustavo A. R. Silva
@ 2022-01-12  1:02 ` Linus Torvalds
  0 siblings, 0 replies; 2+ messages in thread
From: Linus Torvalds @ 2022-01-12  1:02 UTC (permalink / raw)
  To: Gustavo A. R. Silva; +Cc: Kees Cook, linux-hardening, Linux Kernel Mailing List

[-- Attachment #1: Type: text/plain, Size: 1791 bytes --]

On Tue, Jan 11, 2022 at 11:08 AM Gustavo A. R. Silva
<gustavoars@kernel.org> wrote:
>
> Please, pull the following patches that fix some fall-through warnings
> when building with Clang and -Wimplicit-fallthrough.

Ugh. I started pulling that, and then I actually looked at this one:

> Gustavo A. R. Silva (1):
>       MIPS: mm: tlbex: Fix fall-through warning for Clang

and that's just too ugly to live.

It was ugly before, but now it's just insane.

It literally has an if-statement with a block statement that contains
other cases.

Fine, that's not illegal, and Duff's device made the model famous.

But in this case, there's no actual _reason_ for it. It literally
looks like a mistake to me.

There's no reason to have that block statement in the first place, and
there's *doubly* no reason to add a "fallthrough" to other case
statements that then just do a "break" anyway.

I notice that we actually had that exact same pattern earlier, see
line 2166 in that same line. And it's equally bogus there. Actually,
it's even more bogus there, because the indentation is wrong too!

So I _think_ that patch should do something like the attached, but I
didn't actually test this in any way (I didn't check my mips
cross-build setup), and this is all so ugly that I have to avert my
eyes to even attach that patch to this email.

I also don't understand why it's doing that 'switch ()' on the
current_cpu_type(), only to avoid the 'cpu_has_mips_r2_exec_hazard'
test, Which is just _another_ switch on current_cpu_type().

All this code is completely incomprehensibly oddly written. It looks
like some kind of cut-and-paste thing with no actual understanding of
the code. And I refuse to make it worse than it already is by adding
even *more* mindless blather to it.

               Linus

[-- Attachment #2: patch.diff --]
[-- Type: text/x-patch, Size: 1055 bytes --]

 arch/mips/mm/tlbex.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/arch/mips/mm/tlbex.c b/arch/mips/mm/tlbex.c
index b131e6a77383..74f557ed50b0 100644
--- a/arch/mips/mm/tlbex.c
+++ b/arch/mips/mm/tlbex.c
@@ -2161,15 +2161,14 @@ static void build_r4000_tlb_load_handler(void)
 
 		switch (current_cpu_type()) {
 		default:
-			if (cpu_has_mips_r2_exec_hazard) {
+			if (cpu_has_mips_r2_exec_hazard)
 				uasm_i_ehb(&p);
-			fallthrough;
+			break;
 
 		case CPU_CAVIUM_OCTEON:
 		case CPU_CAVIUM_OCTEON_PLUS:
 		case CPU_CAVIUM_OCTEON2:
-				break;
-			}
+			break;
 		}
 
 		/* Examine  entrylo 0 or 1 based on ptr. */
@@ -2237,14 +2236,14 @@ static void build_r4000_tlb_load_handler(void)
 
 		switch (current_cpu_type()) {
 		default:
-			if (cpu_has_mips_r2_exec_hazard) {
+			if (cpu_has_mips_r2_exec_hazard)
 				uasm_i_ehb(&p);
+			break;
 
 		case CPU_CAVIUM_OCTEON:
 		case CPU_CAVIUM_OCTEON_PLUS:
 		case CPU_CAVIUM_OCTEON2:
-				break;
-			}
+			break;
 		}
 
 		/* Examine  entrylo 0 or 1 based on ptr. */

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-01-12  1:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-11 19:14 [GIT PULL] fallthrough fixes for Clang for 5.17-rc1 Gustavo A. R. Silva
2022-01-12  1:02 ` Linus Torvalds

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.