libpfring: fix compilation warning
Fix simple compilation warning with checking statically allocated variables and missing fallthrough. Fix compilation warning: /home/ansuel/openwrt-ansuel/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-ipq807x_generic/PF_RING-8.0.0/kernel/pf_ring.c: In function 'ring_release': /home/ansuel/openwrt-ansuel/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-ipq807x_generic/PF_RING-8.0.0/kernel/pf_ring.c:5489:6: error: the comparison will always evaluate as 'true' for the address of 'name' will never be NULL [-Werror=address] 5489 | && pfr->zc_device_entry->zc_dev.dev->name) { | ^~ In file included from ./include/linux/rtnetlink.h:7, from /home/ansuel/openwrt-ansuel/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-ipq807x_generic/PF_RING-8.0.0/kernel/pf_ring.c:84: ./include/linux/netdevice.h:1986:33: note: 'name' declared here 1986 | char name[IFNAMSIZ]; | ^~~~ /home/ansuel/openwrt-ansuel/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-ipq807x_generic/PF_RING-8.0.0/kernel/pf_ring.c: In function 'ring_bind': /home/ansuel/openwrt-ansuel/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-ipq807x_generic/PF_RING-8.0.0/kernel/pf_ring.c:5620:18: error: the comparison will always evaluate as 'false' for the address of 'sa_data' will never be NULL [-Werror=address] 5620 | if(sa->sa_data == NULL) | ^~ In file included from /home/ansuel/openwrt-ansuel/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-ipq807x_generic/PF_RING-8.0.0/kernel/pf_ring.c:82: ./include/linux/socket.h:34:25: note: 'sa_data' declared here 34 | char sa_data[14]; /* 14 bytes of protocol address */ | ^~~~~~~ /home/ansuel/openwrt-ansuel/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-ipq807x_generic/PF_RING-8.0.0/kernel/pf_ring.c: In function 'hash_pkt_cluster': /home/ansuel/openwrt-ansuel/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-ipq807x_generic/PF_RING-8.0.0/kernel/pf_ring.c:3937:7: error: this statement may fall through [-Werror=implicit-fallthrough=] 3937 | if(l3_proto == IPPROTO_TCP) | ^ /home/ansuel/openwrt-ansuel/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-ipq807x_generic/PF_RING-8.0.0/kernel/pf_ring.c:3944:3: note: here 3944 | case cluster_per_flow_2_tuple: | ^~~~ cc1: all warnings being treated as errors Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
This commit is contained in:
parent
d3e10fd823
commit
2f86385ff5
1 changed files with 30 additions and 0 deletions
30
libs/libpfring/patches/100-fix-compilation-warning.patch
Normal file
30
libs/libpfring/patches/100-fix-compilation-warning.patch
Normal file
|
@ -0,0 +1,30 @@
|
|||
--- a/kernel/pf_ring.c
|
||||
+++ b/kernel/pf_ring.c
|
||||
@@ -3940,7 +3940,7 @@ static int hash_pkt_cluster(ring_cluster_element *cluster_ptr,
|
||||
break;
|
||||
}
|
||||
/* else, fall through, because it's like 2-tuple for non-TCP packets */
|
||||
-
|
||||
+ fallthrough;
|
||||
case cluster_per_flow_2_tuple:
|
||||
case cluster_per_inner_flow_2_tuple:
|
||||
flags |= mask_2_tuple;
|
||||
@@ -5485,8 +5485,7 @@ static int ring_release(struct socket *sock)
|
||||
remove_cluster_referee(pfr);
|
||||
|
||||
if((pfr->zc_device_entry != NULL)
|
||||
- && pfr->zc_device_entry->zc_dev.dev
|
||||
- && pfr->zc_device_entry->zc_dev.dev->name) {
|
||||
+ && pfr->zc_device_entry->zc_dev.dev) {
|
||||
pfring_release_zc_dev(pfr);
|
||||
}
|
||||
|
||||
@@ -5617,8 +5616,6 @@ static int ring_bind(struct socket *sock, struct sockaddr *sa, int addr_len)
|
||||
return(-EINVAL);
|
||||
if(sa->sa_family != PF_RING)
|
||||
return(-EINVAL);
|
||||
- if(sa->sa_data == NULL)
|
||||
- return(-EINVAL);
|
||||
|
||||
memcpy(name, sa->sa_data, sizeof(sa->sa_data));
|
||||
|
Loading…
Reference in a new issue