* [PATCH] ARM: alignment: Mark expected switch fall-throughs
@ 2019-07-28 23:19 Gustavo A. R. Silva
2019-07-29 16:34 ` Kees Cook
0 siblings, 1 reply; 2+ messages in thread
From: Gustavo A. R. Silva @ 2019-07-28 23:19 UTC (permalink / raw)
To: Russell King
Cc: linux-arm-kernel, linux-kernel, Gustavo A. R. Silva,
Stephen Rothwell, Kees Cook
Mark switch cases where we are expecting to fall through.
This patch fixes the following warnings:
arch/arm/mm/alignment.c: In function 'thumb2arm':
arch/arm/mm/alignment.c:688:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
if ((tinstr & (3 << 9)) == 0x0400) {
^
arch/arm/mm/alignment.c:700:2: note: here
default:
^~~~~~~
arch/arm/mm/alignment.c: In function 'do_alignment_t32_to_handler':
arch/arm/mm/alignment.c:753:15: warning: this statement may fall through [-Wimplicit-fallthrough=]
poffset->un = (tinst2 & 0xff) << 2;
~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
arch/arm/mm/alignment.c:754:2: note: here
case 0xe940:
^~~~
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
arch/arm/mm/alignment.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mm/alignment.c b/arch/arm/mm/alignment.c
index 8cdb78642e93..04b36436cbc0 100644
--- a/arch/arm/mm/alignment.c
+++ b/arch/arm/mm/alignment.c
@@ -695,7 +695,7 @@ thumb2arm(u16 tinstr)
return subset[(L<<1) | ((tinstr & (1<<8)) >> 8)] |
(tinstr & 255); /* register_list */
}
- /* Else fall through for illegal instruction case */
+ /* Else, fall through - for illegal instruction case */
default:
return BAD_INSTR;
@@ -751,6 +751,8 @@ do_alignment_t32_to_handler(unsigned long *pinstr, struct pt_regs *regs,
case 0xe8e0:
case 0xe9e0:
poffset->un = (tinst2 & 0xff) << 2;
+ /* Fall through */
+
case 0xe940:
case 0xe9c0:
return do_alignment_ldrdstrd;
--
2.22.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ARM: alignment: Mark expected switch fall-throughs
2019-07-28 23:19 [PATCH] ARM: alignment: Mark expected switch fall-throughs Gustavo A. R. Silva
@ 2019-07-29 16:34 ` Kees Cook
0 siblings, 0 replies; 2+ messages in thread
From: Kees Cook @ 2019-07-29 16:34 UTC (permalink / raw)
To: Gustavo A. R. Silva
Cc: Russell King, linux-arm-kernel, linux-kernel, Stephen Rothwell
On Sun, Jul 28, 2019 at 06:19:20PM -0500, Gustavo A. R. Silva wrote:
> Mark switch cases where we are expecting to fall through.
>
> This patch fixes the following warnings:
>
> arch/arm/mm/alignment.c: In function 'thumb2arm':
> arch/arm/mm/alignment.c:688:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
> if ((tinstr & (3 << 9)) == 0x0400) {
> ^
> arch/arm/mm/alignment.c:700:2: note: here
> default:
> ^~~~~~~
> arch/arm/mm/alignment.c: In function 'do_alignment_t32_to_handler':
> arch/arm/mm/alignment.c:753:15: warning: this statement may fall through [-Wimplicit-fallthrough=]
> poffset->un = (tinst2 & 0xff) << 2;
> ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
> arch/arm/mm/alignment.c:754:2: note: here
> case 0xe940:
> ^~~~
>
> Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
-Kees
> ---
> arch/arm/mm/alignment.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm/mm/alignment.c b/arch/arm/mm/alignment.c
> index 8cdb78642e93..04b36436cbc0 100644
> --- a/arch/arm/mm/alignment.c
> +++ b/arch/arm/mm/alignment.c
> @@ -695,7 +695,7 @@ thumb2arm(u16 tinstr)
> return subset[(L<<1) | ((tinstr & (1<<8)) >> 8)] |
> (tinstr & 255); /* register_list */
> }
> - /* Else fall through for illegal instruction case */
> + /* Else, fall through - for illegal instruction case */
>
> default:
> return BAD_INSTR;
> @@ -751,6 +751,8 @@ do_alignment_t32_to_handler(unsigned long *pinstr, struct pt_regs *regs,
> case 0xe8e0:
> case 0xe9e0:
> poffset->un = (tinst2 & 0xff) << 2;
> + /* Fall through */
> +
> case 0xe940:
> case 0xe9c0:
> return do_alignment_ldrdstrd;
> --
> 2.22.0
>
--
Kees Cook
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-07-29 16:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-28 23:19 [PATCH] ARM: alignment: Mark expected switch fall-throughs Gustavo A. R. Silva
2019-07-29 16:34 ` Kees Cook
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).