x86/insn-eval: Mark expected switch-case fall-through
authorGustavo A. R. Silva <gustavo@embeddedor.com>
Fri, 25 Jan 2019 20:55:20 +0000 (14:55 -0600)
committerBorislav Petkov <bp@suse.de>
Sat, 26 Jan 2019 09:46:42 +0000 (10:46 +0100)
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

index 9119d8e41f1ff59e2c8584a36f0f03d000bb1bbe..cf00ab6c662108280aadb7c8ffe719645b1699c5 100644 (file)
@@ -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):