2019-01-14 20:32:01

by Mathieu Malaterre

[permalink] [raw]
Subject: [PATCH] capabilities:: annotate implicit fall through

There is a plan to build the kernel with -Wimplicit-fallthrough and
this place in the code produced a warning (W=1).

In this particular case change put the fall through comment on a single
line so as to match the regular expression expected by GCC.

This commit remove the following warning:

kernel/capability.c:95:3: warning: this statement may fall through [-Wimplicit-fallthrough=]

Signed-off-by: Mathieu Malaterre <[email protected]>
---
kernel/capability.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/kernel/capability.c b/kernel/capability.c
index 1e1c0236f55b..e60be18b98e2 100644
--- a/kernel/capability.c
+++ b/kernel/capability.c
@@ -93,9 +93,7 @@ static int cap_validate_magic(cap_user_header_t header, unsigned *tocopy)
break;
case _LINUX_CAPABILITY_VERSION_2:
warn_deprecated_v2();
- /*
- * fall through - v3 is otherwise equivalent to v2.
- */
+ /* fall through - v3 is otherwise equivalent to v2. */
case _LINUX_CAPABILITY_VERSION_3:
*tocopy = _LINUX_CAPABILITY_U32S_3;
break;
--
2.19.2



2019-01-14 21:16:56

by Gustavo A. R. Silva

[permalink] [raw]
Subject: Re: [PATCH] capabilities:: annotate implicit fall through



On 1/14/19 2:28 PM, Mathieu Malaterre wrote:
> There is a plan to build the kernel with -Wimplicit-fallthrough and
> this place in the code produced a warning (W=1).
>
> In this particular case change put the fall through comment on a single
> line so as to match the regular expression expected by GCC.
>
> This commit remove the following warning:
>
> kernel/capability.c:95:3: warning: this statement may fall through [-Wimplicit-fallthrough=]
>
> Signed-off-by: Mathieu Malaterre <[email protected]>

Acked-by: Gustavo A. R. Silva <[email protected]>

Thanks

> ---
> kernel/capability.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/kernel/capability.c b/kernel/capability.c
> index 1e1c0236f55b..e60be18b98e2 100644
> --- a/kernel/capability.c
> +++ b/kernel/capability.c
> @@ -93,9 +93,7 @@ static int cap_validate_magic(cap_user_header_t header, unsigned *tocopy)
> break;
> case _LINUX_CAPABILITY_VERSION_2:
> warn_deprecated_v2();
> - /*
> - * fall through - v3 is otherwise equivalent to v2.
> - */
> + /* fall through - v3 is otherwise equivalent to v2. */
> case _LINUX_CAPABILITY_VERSION_3:
> *tocopy = _LINUX_CAPABILITY_U32S_3;
> break;
>

2019-01-23 03:45:25

by James Morris

[permalink] [raw]
Subject: Re: [PATCH] capabilities:: annotate implicit fall through

On Mon, 14 Jan 2019, Mathieu Malaterre wrote:

> There is a plan to build the kernel with -Wimplicit-fallthrough and
> this place in the code produced a warning (W=1).
>
> In this particular case change put the fall through comment on a single
> line so as to match the regular expression expected by GCC.
>
> This commit remove the following warning:
>
> kernel/capability.c:95:3: warning: this statement may fall through [-Wimplicit-fallthrough=]
>
> Signed-off-by: Mathieu Malaterre <[email protected]>

Applied to
git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security.git next-general

--
James Morris
<[email protected]>