Skip to contentSkip to conversation

netfilter: nf_conntrack_sip: fix wrong memory initialisation

PATCH Applied Christophe Leroy 3 participants 3 messages Mar 1, 2017 – Mar 3, 2017

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

PATCH 1/1 netfilter: nf_conntrack_sip: fix wrong memory initialisation

In commit 82de0be6862cd ("netfilter: Add helper array register/unregister functions"),
struct nf_conntrack_helper sip[MAX_PORTS][4] was changed to sip[MAX_PORTS * 4], so the memory init should have been changed to memset(&sip[4 * i], 0, 4 * sizeof(sip[i]));

But as the sip[] table is allocated in the BSS, it is already set to 0

Fixes 82de0be6862cd ("netfilter: Add helper array

register/unregister functions")
Cc: [email protected]

---
 net/netfilter/nf_conntrack_sip.c | 2 --
 1 file changed, 2 deletions(-)
net/netfilter/nf_conntrack_sip.c +0 -2
index 24174c520239..0d17894798b5 100644
@@ -1628,8 +1628,6 @@ static int __init nf_conntrack_sip_init(void)
 		ports[ports_c++] = SIP_PORT;
 
 	for (i = 0; i < ports_c; i++) {
-		memset(&sip[i], 0, sizeof(sip[i]));
-
 		nf_ct_helper_init(&sip[4 * i], AF_INET, IPPROTO_UDP, "sip",
 				  SIP_PORT, ports[i], i, sip_exp_policy,
 				  SIP_EXPECT_MAX,
Signature · 1 line
2.12.0
#1 lore raw
Quoted 5 lines · Christophe Leroy

In commit 82de0be6862cd ("netfilter: Add helper array register/unregister functions"),
struct nf_conntrack_helper sip[MAX_PORTS][4] was changed to sip[MAX_PORTS * 4], so the memory init should have been changed to memset(&sip[4 * i], 0, 4 * sizeof(sip[i]));

Yes, the memset initialization should be changed too.

Thanks
Feng

Quoted 28 lines

But as the sip[] table is allocated in the BSS, it is already set to 0

Fixes 82de0be6862cd ("netfilter: Add helper array

register/unregister functions")
Cc: [email protected]

---
 net/netfilter/nf_conntrack_sip.c | 2 --
 1 file changed, 2 deletions(-)
net/netfilter/nf_conntrack_sip.c +0 -3
index 24174c520239..0d17894798b5 100644
@@ -1628,8 +1628,6 @@ static int __init nf_conntrack_sip_init(void)
                ports[ports_c++] = SIP_PORT;
 
        for (i = 0; i < ports_c; i++) {
-               memset(&sip[i], 0, sizeof(sip[i]));
-
                nf_ct_helper_init(&sip[4 * i], AF_INET, IPPROTO_UDP, "sip",
                                  SIP_PORT, ports[i], i, sip_exp_policy,
                                  SIP_EXPECT_MAX,
--

2.12.0

maintainer Applied
#2 lore raw
In reply to Christophe Leroy
Quoted 7 lines · Christophe Leroy

In commit 82de0be6862cd ("netfilter: Add helper array register/unregister functions"),
struct nf_conntrack_helper sip[MAX_PORTS][4] was changed to sip[MAX_PORTS * 4], so the memory init should have been changed to memset(&sip[4 * i], 0, 4 * sizeof(sip[i]));

But as the sip[] table is allocated in the BSS, it is already set to 0

Applied, thanks.