* [PATCH] lib/cmdline.c: mark expected switch fall-throughs
@ 2019-01-25 20:31 Gustavo A. R. Silva
2019-01-26 0:18 ` Kees Cook
0 siblings, 1 reply; 3+ messages in thread
From: Gustavo A. R. Silva @ 2019-01-25 20:31 UTC (permalink / raw)
To: linux-kernel; +Cc: 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 warnings:
lib/cmdline.c:137:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
lib/cmdline.c:140:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
lib/cmdline.c:143:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
lib/cmdline.c:146:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
lib/cmdline.c:149:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
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>
---
lib/cmdline.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/lib/cmdline.c b/lib/cmdline.c
index 171c19b6888e..dc59d6216318 100644
--- a/lib/cmdline.c
+++ b/lib/cmdline.c
@@ -135,18 +135,23 @@ unsigned long long memparse(const char *ptr, char **retptr)
case 'E':
case 'e':
ret <<= 10;
+ /* fall through */
case 'P':
case 'p':
ret <<= 10;
+ /* fall through */
case 'T':
case 't':
ret <<= 10;
+ /* fall through */
case 'G':
case 'g':
ret <<= 10;
+ /* fall through */
case 'M':
case 'm':
ret <<= 10;
+ /* fall through */
case 'K':
case 'k':
ret <<= 10;
--
2.20.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] lib/cmdline.c: mark expected switch fall-throughs
2019-01-25 20:31 [PATCH] lib/cmdline.c: mark expected switch fall-throughs Gustavo A. R. Silva
@ 2019-01-26 0:18 ` Kees Cook
2019-01-26 0:56 ` Gustavo A. R. Silva
0 siblings, 1 reply; 3+ messages in thread
From: Kees Cook @ 2019-01-26 0:18 UTC (permalink / raw)
To: Gustavo A. R. Silva; +Cc: LKML
On Sat, Jan 26, 2019 at 9:31 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.
>
> This patch fixes the following warnings:
>
> lib/cmdline.c:137:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
> lib/cmdline.c:140:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
> lib/cmdline.c:143:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
> lib/cmdline.c:146:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
> lib/cmdline.c:149:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
>
> 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>
Acked-by: Kees Cook <keescook@chromium.org>
-Kees
> ---
> lib/cmdline.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/lib/cmdline.c b/lib/cmdline.c
> index 171c19b6888e..dc59d6216318 100644
> --- a/lib/cmdline.c
> +++ b/lib/cmdline.c
> @@ -135,18 +135,23 @@ unsigned long long memparse(const char *ptr, char **retptr)
> case 'E':
> case 'e':
> ret <<= 10;
> + /* fall through */
> case 'P':
> case 'p':
> ret <<= 10;
> + /* fall through */
> case 'T':
> case 't':
> ret <<= 10;
> + /* fall through */
> case 'G':
> case 'g':
> ret <<= 10;
> + /* fall through */
> case 'M':
> case 'm':
> ret <<= 10;
> + /* fall through */
> case 'K':
> case 'k':
> ret <<= 10;
> --
> 2.20.1
>
--
Kees Cook
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] lib/cmdline.c: mark expected switch fall-throughs
2019-01-26 0:18 ` Kees Cook
@ 2019-01-26 0:56 ` Gustavo A. R. Silva
0 siblings, 0 replies; 3+ messages in thread
From: Gustavo A. R. Silva @ 2019-01-26 0:56 UTC (permalink / raw)
To: Kees Cook; +Cc: LKML
On 1/25/19 6:18 PM, Kees Cook wrote:
> On Sat, Jan 26, 2019 at 9:31 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.
>>
>> This patch fixes the following warnings:
>>
>> lib/cmdline.c:137:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
>> lib/cmdline.c:140:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
>> lib/cmdline.c:143:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
>> lib/cmdline.c:146:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
>> lib/cmdline.c:149:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
>>
>> 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>
>
> Acked-by: Kees Cook <keescook@chromium.org>
>
Now applied to for-next/kspp, thanks.
https://git.kernel.org/gustavoars/c/5dd481673c3ddd27d36851754bafbaa82bdff34f
Cheers!
--
Gustavo
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-01-26 0:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-25 20:31 [PATCH] lib/cmdline.c: mark expected switch fall-throughs Gustavo A. R. Silva
2019-01-26 0:18 ` Kees Cook
2019-01-26 0:56 ` Gustavo A. R. Silva
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).