All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/insn-eval: Mark expected switch fall-through
@ 2019-01-25 20:55 Gustavo A. R. Silva
  2019-01-26  9:47 ` Borislav Petkov
  2019-01-26 10:15 ` [tip:x86/cleanups] x86/insn-eval: Mark expected switch-case fall-through tip-bot for Gustavo A. R. Silva
  0 siblings, 2 replies; 4+ messages in thread
From: Gustavo A. R. Silva @ 2019-01-25 20:55 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, Borislav Petkov, H. Peter Anvin,
	x86
  Cc: linux-kernel, Gustavo A. R. Silva, Kees Cook

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.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
 arch/x86/lib/insn-eval.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/x86/lib/insn-eval.c b/arch/x86/lib/insn-eval.c
index 9119d8e41f1f..8f1b2d8db4e2 100644
--- a/arch/x86/lib/insn-eval.c
+++ b/arch/x86/lib/insn-eval.c
@@ -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):
-- 
2.20.1


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

* Re: [PATCH] x86/insn-eval: Mark expected switch fall-through
  2019-01-25 20:55 [PATCH] x86/insn-eval: Mark expected switch fall-through Gustavo A. R. Silva
@ 2019-01-26  9:47 ` Borislav Petkov
  2019-01-26 14:05   ` Gustavo A. R. Silva
  2019-01-26 10:15 ` [tip:x86/cleanups] x86/insn-eval: Mark expected switch-case fall-through tip-bot for Gustavo A. R. Silva
  1 sibling, 1 reply; 4+ messages in thread
From: Borislav Petkov @ 2019-01-26  9:47 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86, linux-kernel,
	Kees Cook

On Fri, Jan 25, 2019 at 02:55:20PM -0600, Gustavo A. R. Silva wrote:
> 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

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.

-- 
Regards/Gruss,
    Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.

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

* [tip:x86/cleanups] x86/insn-eval: Mark expected switch-case fall-through
  2019-01-25 20:55 [PATCH] x86/insn-eval: Mark expected switch fall-through Gustavo A. R. Silva
  2019-01-26  9:47 ` Borislav Petkov
@ 2019-01-26 10:15 ` tip-bot for Gustavo A. R. Silva
  1 sibling, 0 replies; 4+ messages in thread
From: tip-bot for Gustavo A. R. Silva @ 2019-01-26 10:15 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: x86, bp, tglx, gustavo, linux-kernel, mingo, hpa, mingo, keescook

Commit-ID:  89da3446294a8b811b28a4807e74e7ee7044d49f
Gitweb:     https://git.kernel.org/tip/89da3446294a8b811b28a4807e74e7ee7044d49f
Author:     Gustavo A. R. Silva <gustavo@embeddedor.com>
AuthorDate: Fri, 25 Jan 2019 14:55:20 -0600
Committer:  Borislav Petkov <bp@suse.de>
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. ]

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: x86-ml <x86@kernel.org>
Link: https://lkml.kernel.org/r/20190125205520.GA9602@embeddedor
---
 arch/x86/lib/insn-eval.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/x86/lib/insn-eval.c b/arch/x86/lib/insn-eval.c
index 9119d8e41f1f..cf00ab6c6621 100644
--- a/arch/x86/lib/insn-eval.c
+++ b/arch/x86/lib/insn-eval.c
@@ -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):

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

* Re: [PATCH] x86/insn-eval: Mark expected switch fall-through
  2019-01-26  9:47 ` Borislav Petkov
@ 2019-01-26 14:05   ` Gustavo A. R. Silva
  0 siblings, 0 replies; 4+ messages in thread
From: Gustavo A. R. Silva @ 2019-01-26 14:05 UTC (permalink / raw)
  To: Borislav Petkov
  Cc: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86, linux-kernel,
	Kees Cook

Boris,

On 1/26/19 3:47 AM, Borislav Petkov wrote:
> On Fri, Jan 25, 2019 at 02:55:20PM -0600, Gustavo A. R. Silva wrote:
>> 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
> 
> 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.
> 

I've got it.

Thanks for the feedback.

--
Gustavo

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

end of thread, other threads:[~2019-01-26 14:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-01-25 20:55 [PATCH] x86/insn-eval: Mark expected switch fall-through Gustavo A. R. Silva
2019-01-26  9:47 ` Borislav Petkov
2019-01-26 14:05   ` Gustavo A. R. Silva
2019-01-26 10:15 ` [tip:x86/cleanups] x86/insn-eval: Mark expected switch-case fall-through tip-bot for Gustavo A. R. Silva

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.