Skip to contentSkip to conversation

bpf: annotate implicit fall through

PATCH Superseded Mathieu Malaterre 3 participants 8 messages Jan 14, 2019 – Jan 17, 2019

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

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=]

---
 kernel/bpf/cgroup.c | 1 +
 1 file changed, 1 insertion(+)
kernel/bpf/cgroup.c +1 -0
index 9425c2fb872f..ab612fe9862f 100644
@@ -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;
 	}
Signature · 1 line
2.19.2
#1 lore raw

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=]

---
 net/core/filter.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/filter.c +1 -1
index 447dd1bad31f..c8069a142994 100644
@@ -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;
 	}
Signature · 1 line
2.19.2
#2 lore raw
Quoted 2 lines · Mathieu Malaterre

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

This?

Quoted 17 lines

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=]

---
  net/core/filter.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
net/core/filter.c +0 -0
index 447dd1bad31f..c8069a142994 100644

net/core/filter.c bpf_base_func_proto(enum bpf_func_id func_id) · line 5312

Quoted 5 lines
net/core/filter.c +1 -1
@@ -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:"...

net/core/filter.c bpf_base_func_proto(enum bpf_func_id func_id) · line 5315

Quoted 4 lines
net/core/filter.c +0 -0
  	default:
  		return NULL;
  	}

MBR, Sergei

maintainer
#3 lore raw
Quoted 15 lines · Sergei Shtylyov
Quoted 2 lines · Mathieu Malaterre

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

   This?

Quoted 8 lines

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=]

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

Thanks,
Daniel

Quoted 23 lines
Quoted 9 lines

---
  net/core/filter.c | 2 +-

  1 file changed, 1 insertion(+), 1 deletion(-)
net/core/filter.c +0 -0
index 447dd1bad31f..c8069a142994 100644
@@ -5309,7 +5309,7 @@ bpf_base_func_proto(enum bpf_func_id func_id)
Quoted 5 lines

      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:"...

Quoted 4 lines

      default:
          return NULL;
      }

MBR, Sergei

#4 lore raw

PATCH v2 2/2 bpf: Correctly annotate implicit fall through in bpf_base_func_proto

In reply to Mathieu Malaterre

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=]

---
v2: reword the patch subject, remove a typo

 net/core/filter.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/filter.c +1 -1
index 2b3b436ef545..d9076e609fca 100644
@@ -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;
 	}
Signature · 1 line
2.19.2
#5 lore raw

PATCH v2 1/2 bpf: Annotate implicit fall through in cgroup_dev_func_proto

In reply to Mathieu Malaterre

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=]

---
 kernel/bpf/cgroup.c | 1 +
 1 file changed, 1 insertion(+)
kernel/bpf/cgroup.c +1 -0
index 9425c2fb872f..ab612fe9862f 100644
@@ -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;
 	}
Signature · 1 line
2.19.2
#6 lore raw

PATCH v2 1/2 bpf: Annotate implicit fall through in cgroup_dev_func_proto

In reply to Mathieu Malaterre

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=]

---
v2: Reword the patch subject

 kernel/bpf/cgroup.c | 1 +
 1 file changed, 1 insertion(+)
kernel/bpf/cgroup.c +1 -0
index 9425c2fb872f..ab612fe9862f 100644
@@ -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;
 	}
Signature · 1 line
2.19.2
maintainer
#7 lore raw

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

Quoted 8 lines · Mathieu Malaterre

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=]

Both applied, thanks!