Kill bogus memsets
Subsystems (2)
PATCH 2/7 Kill bogus memsets
nfattr_parse_attributes already set to zero the array of nfattr, so such initialization isn't required.
net/ipv4/netfilter/ip_conntrack_netlink.c +0 -8
@@ -479,7 +479,6 @@DEBUGP ("entered %s\n" , __FUNCTION__); -memset (tb,0 ,CTA_IP_MAX *sizeof (tb));if (nfattr_parse_nested (tb,CTA_IP_MAX , attr) <0 ) goto nfattr_failure;
@@ -522,8 +521,6 @@DEBUGP ("entered %s\n" , __FUNCTION__); -memset (tb,0 ,CTA_PROTO_MAX *sizeof (tb)); -if (nfattr_parse_nested (tb,CTA_PROTO_MAX , attr) <0 ) goto nfattr_failure;
@@ -556,7 +553,6 @@DEBUGP ("entered %s\n" , __FUNCTION__); -memset (tb,0 ,CTA_TUPLE_MAX *sizeof (tb));memset (tuple,0 ,sizeof (*tuple));if (nfattr_parse_nested (tb,CTA_TUPLE_MAX , cda[type-1 ]) <0 )
@@ -607,8 +603,6 @@DEBUGP ("entered %s\n" , __FUNCTION__); -memset (tb,0 ,CTA_PROTONAT_MAX *sizeof (tb)); -if (nfattr_parse_nested (tb,CTA_PROTONAT_MAX , attr) <0 ) goto nfattr_failure;
@@ -646,7 +640,6 @@DEBUGP ("entered %s\n" , __FUNCTION__); -memset (tb,0 ,CTA_NAT_MAX *sizeof (tb));memset (range,0 ,sizeof (*range));if (nfattr_parse_nested (tb,CTA_NAT_MAX , cda[CTA_NAT -1 ]) <0 )
@@ -684,7 +677,6 @@struct nfattr *tb[CTA_HELP_MAX ];DEBUGP ("entered %s\n" , __FUNCTION__); -memset (tb,0 ,CTA_HELP_MAX *sizeof (tb));if (nfattr_parse_nested (tb,CTA_HELP_MAX , attr) <0 ) goto nfattr_failure;
Quoted 2 lines · Pablo Neira
nfattr_parse_attributesalready set to zero the array of nfattr, so such initialization isn't required.
I think you are referring to nfattr_parse[] ;) And yes, you are correct, we can kill those memset's. I'll apply your patch (and push it to davem). Please include a "Signed-off-by:" Line with your future patches, thanks!
Signature · 5 lines
- Harald Welte <[email protected]> http://netfilter.org/ ============================================================================ "Fragmentation is like classful addressing -- an interesting early architectural error that shows how much experimentation was going on while IP was being designed." -- Paul Vixie