2019-01-14 20:31:29

by Mathieu Malaterre

[permalink] [raw]
Subject: [PATCH 1/2] bpf: annotate implicit fall through

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

This commit remove the following warning:

kernel/bpf/cgroup.c:719:6: warning: this statement may fall through [-Wimplicit-fallthrough=]

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

diff --git a/kernel/bpf/cgroup.c b/kernel/bpf/cgroup.c
index 9425c2fb872f..ab612fe9862f 100644
--- a/kernel/bpf/cgroup.c
+++ b/kernel/bpf/cgroup.c
@@ -718,6 +718,7 @@ cgroup_dev_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)
case BPF_FUNC_trace_printk:
if (capable(CAP_SYS_ADMIN))
return bpf_get_trace_printk_proto();
+ /* fall through */
default:
return NULL;
}
--
2.19.2



2019-01-14 20:32:05

by Mathieu Malaterre

[permalink] [raw]
Subject: [PATCH 2/2] bpf: annotate implicit fall through

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

In this particular case change a ‘:’ with a ‘,’ so as to match the
regular expression expected by GCC.

This commit remove the following warning:

net/core/filter.c:5310:6: warning: this statement may fall through [-Wimplicit-fallthrough=]

Signed-off-by: Mathieu Malaterre <[email protected]>
---
net/core/filter.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/core/filter.c b/net/core/filter.c
index 447dd1bad31f..c8069a142994 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -5309,7 +5309,7 @@ bpf_base_func_proto(enum bpf_func_id func_id)
case BPF_FUNC_trace_printk:
if (capable(CAP_SYS_ADMIN))
return bpf_get_trace_printk_proto();
- /* else: fall through */
+ /* else, fall through */
default:
return NULL;
}
--
2.19.2


2019-01-15 09:48:20

by Sergei Shtylyov

[permalink] [raw]
Subject: Re: [PATCH 2/2] bpf: annotate implicit fall through

On 14.01.2019 23:29, Mathieu Malaterre wrote:

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

This?

> In this particular case change a ‘:’ with a ‘,’ so as to match the
> regular expression expected by GCC.
>
> This commit remove the following warning:
>
> net/core/filter.c:5310:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
>
> Signed-off-by: Mathieu Malaterre <[email protected]>
> ---
> net/core/filter.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/core/filter.c b/net/core/filter.c
> index 447dd1bad31f..c8069a142994 100644
> --- a/net/core/filter.c
> +++ b/net/core/filter.c
> @@ -5309,7 +5309,7 @@ bpf_base_func_proto(enum bpf_func_id func_id)
> case BPF_FUNC_trace_printk:
> if (capable(CAP_SYS_ADMIN))
> return bpf_get_trace_printk_proto();
> - /* else: fall through */
> + /* else, fall through */

The other patches seem to just drop "else:"...

> default:
> return NULL;
> }
>

MBR, Sergei

2019-01-16 11:32:48

by Daniel Borkmann

[permalink] [raw]
Subject: Re: [PATCH 2/2] bpf: annotate implicit fall through

On 01/15/2019 10:03 AM, Sergei Shtylyov wrote:
> On 14.01.2019 23:29, Mathieu Malaterre wrote:
>
>> There is a plan to build the kernel with -Wimplicit-fallthrough and
>> thise place in the code produced a warnings (W=1).
>
>    This?
>
>> In this particular case change a ‘:’ with a ‘,’ so as to match the
>> regular expression expected by GCC.
>>
>> This commit remove the following warning:
>>
>>    net/core/filter.c:5310:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
>>
>> Signed-off-by: Mathieu Malaterre <[email protected]>

Please respin and also make the two subject lines not exactly the same.

Thanks,
Daniel

>> ---
>>   net/core/filter.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/net/core/filter.c b/net/core/filter.c
>> index 447dd1bad31f..c8069a142994 100644
>> --- a/net/core/filter.c
>> +++ b/net/core/filter.c
>> @@ -5309,7 +5309,7 @@ bpf_base_func_proto(enum bpf_func_id func_id)
>>       case BPF_FUNC_trace_printk:
>>           if (capable(CAP_SYS_ADMIN))
>>               return bpf_get_trace_printk_proto();
>> -        /* else: fall through */
>> +        /* else, fall through */
>
>    The other patches seem to just drop "else:"...
>
>>       default:
>>           return NULL;
>>       }
>>
>
> MBR, Sergei


2019-01-17 00:26:52

by Mathieu Malaterre

[permalink] [raw]
Subject: [PATCH v2 1/2] bpf: Annotate implicit fall through in cgroup_dev_func_proto

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

This commit remove the following warning:

kernel/bpf/cgroup.c:719:6: warning: this statement may fall through [-Wimplicit-fallthrough=]

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

diff --git a/kernel/bpf/cgroup.c b/kernel/bpf/cgroup.c
index 9425c2fb872f..ab612fe9862f 100644
--- a/kernel/bpf/cgroup.c
+++ b/kernel/bpf/cgroup.c
@@ -718,6 +718,7 @@ cgroup_dev_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)
case BPF_FUNC_trace_printk:
if (capable(CAP_SYS_ADMIN))
return bpf_get_trace_printk_proto();
+ /* fall through */
default:
return NULL;
}
--
2.19.2


2019-01-17 00:29:18

by Mathieu Malaterre

[permalink] [raw]
Subject: [PATCH v2 2/2] bpf: Correctly annotate implicit fall through in bpf_base_func_proto

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

To preserve as much of the existing comment only change a ‘:’ into a ‘,’.
This is enough change, to match the regular expression expected by GCC.

This commit remove the following warning:

net/core/filter.c:5310:6: warning: this statement may fall through [-Wimplicit-fallthrough=]

Signed-off-by: Mathieu Malaterre <[email protected]>
---
v2: reword the patch subject, remove a typo

net/core/filter.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/core/filter.c b/net/core/filter.c
index 2b3b436ef545..d9076e609fca 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -5309,7 +5309,7 @@ bpf_base_func_proto(enum bpf_func_id func_id)
case BPF_FUNC_trace_printk:
if (capable(CAP_SYS_ADMIN))
return bpf_get_trace_printk_proto();
- /* else: fall through */
+ /* else, fall through */
default:
return NULL;
}
--
2.19.2


2019-01-17 07:54:50

by Mathieu Malaterre

[permalink] [raw]
Subject: [PATCH v2 1/2] bpf: Annotate implicit fall through in cgroup_dev_func_proto

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

This commit remove the following warning:

kernel/bpf/cgroup.c:719:6: warning: this statement may fall through [-Wimplicit-fallthrough=]

Signed-off-by: Mathieu Malaterre <[email protected]>
---
v2: Reword the patch subject

kernel/bpf/cgroup.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/kernel/bpf/cgroup.c b/kernel/bpf/cgroup.c
index 9425c2fb872f..ab612fe9862f 100644
--- a/kernel/bpf/cgroup.c
+++ b/kernel/bpf/cgroup.c
@@ -718,6 +718,7 @@ cgroup_dev_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)
case BPF_FUNC_trace_printk:
if (capable(CAP_SYS_ADMIN))
return bpf_get_trace_printk_proto();
+ /* fall through */
default:
return NULL;
}
--
2.19.2


2019-01-17 16:00:07

by Daniel Borkmann

[permalink] [raw]
Subject: Re: [PATCH v2 1/2] bpf: Annotate implicit fall through in cgroup_dev_func_proto

On 01/16/2019 08:35 PM, Mathieu Malaterre wrote:
> There is a plan to build the kernel with -Wimplicit-fallthrough and
> this place in the code produced a warnings (W=1).
>
> This commit remove the following warning:
>
> kernel/bpf/cgroup.c:719:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
>
> Signed-off-by: Mathieu Malaterre <[email protected]>

Both applied, thanks!