[Devel] [PATCH RHEL7 COMMIT] netfilter: conntrack: fix false-positive compiler warning in early_drop()

Konstantin Khorenko khorenko at virtuozzo.com
Fri May 22 13:34:22 MSK 2020


The commit is pushed to "branch-rh7-3.10.0-1127.8.2.vz7.151.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1127.8.2.vz7.151.4
------>
commit 489f5563377d926bb4aef653e230c6c779ca70b6
Author: Konstantin Khorenko <khorenko at virtuozzo.com>
Date:   Fri May 22 13:30:19 2020 +0300

    netfilter: conntrack: fix false-positive compiler warning in early_drop()
    
      net/netfilter/nf_conntrack_core.c: In function 'early_drop':
      net/netfilter/nf_conntrack_core.c:911:21: error: 'bucket' may be used uninitialized in this function [-Werror=maybe-uninitialized]
          bucket = (bucket + 1) % nf_conntrack_htable_size;
                           ^
      cc1: all warnings being treated as errors
    
    "bucket" cannot be uninitialized here, so just make the compiler happy.
    
    https://jira.sw.ru/browse/PSBM-103515
    
    Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
---
 net/netfilter/nf_conntrack_core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
index 1c8223e006b18..1d4c20e241dc7 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -900,6 +900,7 @@ static noinline int early_drop(struct net *net, unsigned int hash)
 	bool ret = false;
 
 	i = 0;
+	bucket = 0; /* compiler false-positive warning workaround */
 
 	local_bh_disable();
 restart:


More information about the Devel mailing list