Skip to contentSkip to conversation

x86/insn-eval: Mark expected switch fall-through

PATCH In review Gustavo A. R. Silva 3 participants 4 messages Jan 25, 2019 – Jan 26, 2019 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/insn-eval: Mark expected switch fall-through

In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through.

This patch fixes the following warning:

arch/x86/lib/insn-eval.c: In function ‘resolve_default_seg’:
arch/x86/lib/insn-eval.c:179:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
if (insn->addr_bytes == 2)

      ^

arch/x86/lib/insn-eval.c:182:2: note: here
case -EDOM:
^~~~

Warning level 3 was used: -Wimplicit-fallthrough=3

This patch is part of the ongoing efforts to enabling -Wimplicit-fallthrough.

---
 arch/x86/lib/insn-eval.c | 1 +
 1 file changed, 1 insertion(+)
arch/x86/lib/insn-eval.c +1 -0
index 9119d8e41f1f..8f1b2d8db4e2 100644
@@ -178,6 +178,7 @@ static int resolve_default_seg(struct insn *insn, struct pt_regs *regs, int off)
 		/* Need insn to verify address size. */
 		if (insn->addr_bytes == 2)
 			return -EINVAL;
+		/* fall through */
 
 	case -EDOM:
 	case offsetof(struct pt_regs, bx):
Signature · 1 line
2.20.1
maintainer
#1 lore raw
Quoted 8 lines · Gustavo A. R. Silva

In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through.

This patch fixes the following warning:

arch/x86/lib/insn-eval.c: In function ‘resolve_default_seg’:
arch/x86/lib/insn-eval.c:179:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
if (insn->addr_bytes == 2)

Quoted 8 lines
      ^

arch/x86/lib/insn-eval.c:182:2: note: here
case -EDOM:
^~~~

Warning level 3 was used: -Wimplicit-fallthrough=3

This patch is part of the ongoing efforts to enabling

For the future:

Avoid having "This patch" or "This commit" in the commit message. It is tautologically useless.

Also, do

$ git grep 'This patch' Documentation/process

for more details.

Signature · 4 lines
Regards/Gruss,
    Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.
#2 lore raw

Boris,

Quoted 20 lines · Borislav Petkov
Quoted 8 lines · Gustavo A. R. Silva

In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through.

This patch fixes the following warning:

arch/x86/lib/insn-eval.c: In function ‘resolve_default_seg’:
arch/x86/lib/insn-eval.c:179:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
if (insn->addr_bytes == 2)

Quoted 8 lines
      ^

arch/x86/lib/insn-eval.c:182:2: note: here
case -EDOM:
^~~~

Warning level 3 was used: -Wimplicit-fallthrough=3

This patch is part of the ongoing efforts to enabling

For the future:

Quoted 9 lines

Avoid having "This patch" or "This commit" in the commit message. It is tautologically useless.

Also, do

$ git grep 'This patch' Documentation/process

for more details.

I've got it.

Thanks for the feedback.

--
Gustavo

#3 lore raw

[tip:x86/cleanups] x86/insn-eval: Mark expected switch-case fall-through

In reply to Gustavo A. R. Silva
x86/insn-eval: Mark expected switch-case fall-through
Commit-ID:  89da3446294a8b811b28a4807e74e7ee7044d49f
Gitweb:     https://git.kernel.org/tip/89da3446294a8b811b28a4807e74e7ee7044d49f
Author:     Gustavo A. R. Silva <[email protected]>
AuthorDate: Fri, 25 Jan 2019 14:55:20 -0600
Committer:  Borislav Petkov <[email protected]>
CommitDate: Sat, 26 Jan 2019 10:46:42 +0100

x86/insn-eval: Mark expected switch-case fall-through

In preparation to enable -Wimplicit-fallthrough by default, mark switch-case statements where fall-through is intentional, explicitly.

Thus fix the following warning:

arch/x86/lib/insn-eval.c: In function ‘resolve_default_seg’:
arch/x86/lib/insn-eval.c:179:6: warning: this statement may fall through [-Wimplicit-fallthrough=]

     if (insn->addr_bytes == 2)
        ^
  arch/x86/lib/insn-eval.c:182:2: note: here
    case -EDOM:
    ^~~~

Warning level 3 was used: -Wimplicit-fallthrough=3

This is part of the ongoing efforts to enable -Wimplicit-fallthrough by default.

[ bp: Massage commit message. ]

---
 arch/x86/lib/insn-eval.c | 2 ++
 1 file changed, 2 insertions(+)
arch/x86/lib/insn-eval.c +2 -0
index 9119d8e41f1f..cf00ab6c6621 100644
@@ -179,6 +179,8 @@ static int resolve_default_seg(struct insn *insn, struct pt_regs *regs, int off)
 		if (insn->addr_bytes == 2)
 			return -EINVAL;
 
+		/* fall through */
+
 	case -EDOM:
 	case offsetof(struct pt_regs, bx):
 	case offsetof(struct pt_regs, si):