linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] compat: Mark expected switch fall-throughs
@ 2018-10-13 11:50 Gustavo A. R. Silva
  2018-10-15 21:30 ` Kees Cook
  0 siblings, 1 reply; 2+ messages in thread
From: Gustavo A. R. Silva @ 2018-10-13 11:50 UTC (permalink / raw)
  To: Andrew Morton, Kees Cook, Michael Ellerman
  Cc: linux-kernel, Gustavo A. R. Silva

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

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
 include/linux/compat.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/include/linux/compat.h b/include/linux/compat.h
index d30e4db..06e7747 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -488,8 +488,11 @@ put_compat_sigset(compat_sigset_t __user *compat, const sigset_t *set,
 	compat_sigset_t v;
 	switch (_NSIG_WORDS) {
 	case 4: v.sig[7] = (set->sig[3] >> 32); v.sig[6] = set->sig[3];
+		/* fall through */
 	case 3: v.sig[5] = (set->sig[2] >> 32); v.sig[4] = set->sig[2];
+		/* fall through */
 	case 2: v.sig[3] = (set->sig[1] >> 32); v.sig[2] = set->sig[1];
+		/* fall through */
 	case 1: v.sig[1] = (set->sig[0] >> 32); v.sig[0] = set->sig[0];
 	}
 	return copy_to_user(compat, &v, size) ? -EFAULT : 0;
-- 
2.7.4


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

* Re: [PATCH] compat: Mark expected switch fall-throughs
  2018-10-13 11:50 [PATCH] compat: Mark expected switch fall-throughs Gustavo A. R. Silva
@ 2018-10-15 21:30 ` Kees Cook
  0 siblings, 0 replies; 2+ messages in thread
From: Kees Cook @ 2018-10-15 21:30 UTC (permalink / raw)
  To: Gustavo A. R. Silva; +Cc: Andrew Morton, Michael Ellerman, LKML

On Sat, Oct 13, 2018 at 4:50 AM, Gustavo A. R. Silva
<gustavo@embeddedor.com> wrote:
> In preparation to enabling -Wimplicit-fallthrough, mark switch cases
> where we are expecting to fall through.
>
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>

Acked-by: Kees Cook <keescook@chromium.org>

-Kees

> ---
>  include/linux/compat.h | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/include/linux/compat.h b/include/linux/compat.h
> index d30e4db..06e7747 100644
> --- a/include/linux/compat.h
> +++ b/include/linux/compat.h
> @@ -488,8 +488,11 @@ put_compat_sigset(compat_sigset_t __user *compat, const sigset_t *set,
>         compat_sigset_t v;
>         switch (_NSIG_WORDS) {
>         case 4: v.sig[7] = (set->sig[3] >> 32); v.sig[6] = set->sig[3];
> +               /* fall through */
>         case 3: v.sig[5] = (set->sig[2] >> 32); v.sig[4] = set->sig[2];
> +               /* fall through */
>         case 2: v.sig[3] = (set->sig[1] >> 32); v.sig[2] = set->sig[1];
> +               /* fall through */
>         case 1: v.sig[1] = (set->sig[0] >> 32); v.sig[0] = set->sig[0];
>         }
>         return copy_to_user(compat, &v, size) ? -EFAULT : 0;
> --
> 2.7.4
>



-- 
Kees Cook
Pixel Security

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

end of thread, other threads:[~2018-10-15 21:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-13 11:50 [PATCH] compat: Mark expected switch fall-throughs Gustavo A. R. Silva
2018-10-15 21:30 ` 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).