Skip to contentSkip to conversation

ipvs: remove unnecessary space

PATCH In review yangxingwu 4 participants 13 messages Jul 10, 2019 – Aug 13, 2019

Subsystems (4)
lore
Share & tools
lore

yangxingwu

author
#0 lore raw

PATCH 1/1 ipvs: remove unnecessary space

this patch removes the extra space.

---
 net/netfilter/ipvs/ip_vs_mh.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
net/netfilter/ipvs/ip_vs_mh.c +2 -2
index 94d9d34..98e358e 100644
@@ -174,8 +174,8 @@ static int ip_vs_mh_populate(struct ip_vs_mh_state *s,
 		return 0;
 	}
 
-	table =  kcalloc(BITS_TO_LONGS(IP_VS_MH_TAB_SIZE),
-			 sizeof(unsigned long), GFP_KERNEL);
+	table =	kcalloc(BITS_TO_LONGS(IP_VS_MH_TAB_SIZE),
+			sizeof(unsigned long), GFP_KERNEL);
 	if (!table)
 		return -ENOMEM;
 
Signature · 1 line
1.8.3.1
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 3 lines · yangxingwu

this patch removes the extra space.

Thanks, this looks good to me.

Pablo, please consider including this in nf-next.

Quoted 22 lines
---
 net/netfilter/ipvs/ip_vs_mh.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
net/netfilter/ipvs/ip_vs_mh.c +2 -2
index 94d9d34..98e358e 100644
@@ -174,8 +174,8 @@ static int ip_vs_mh_populate(struct ip_vs_mh_state *s,
 		return 0;
 	}
 
-	table =  kcalloc(BITS_TO_LONGS(IP_VS_MH_TAB_SIZE),
-			 sizeof(unsigned long), GFP_KERNEL);
+	table =	kcalloc(BITS_TO_LONGS(IP_VS_MH_TAB_SIZE),
+			sizeof(unsigned long), GFP_KERNEL);
 	if (!table)
 		return -ENOMEM;
 
Signature · 1 line
1.8.3.1
#2 lore raw
Quoted 24 lines · Simon Horman
Quoted 3 lines · yangxingwu

this patch removes the extra space.

Thanks, this looks good to me.

Pablo, please consider including this in nf-next.

Quoted 12 lines
---
 net/netfilter/ipvs/ip_vs_mh.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
net/netfilter/ipvs/ip_vs_mh.c +0 -0
index 94d9d34..98e358e 100644
@@ -174,8 +174,8 @@ static int ip_vs_mh_populate(struct ip_vs_mh_state *s,
 		return 0;
 	}
 
Quoted 4 lines

net/netfilter/ipvs/ip_vs_mh.c static int ip_vs_mh_populate(struct ip_vs_mh_state *s, · line 178

Quoted 4 lines
net/netfilter/ipvs/ip_vs_mh.c +2 -2
-	table =  kcalloc(BITS_TO_LONGS(IP_VS_MH_TAB_SIZE),
-			 sizeof(unsigned long), GFP_KERNEL);
+	table =	kcalloc(BITS_TO_LONGS(IP_VS_MH_TAB_SIZE),
+			sizeof(unsigned long), GFP_KERNEL);

bitmap_alloc?

Quoted 6 lines
Quoted 6 lines
net/netfilter/ipvs/ip_vs_mh.c +0 -0
 	if (!table)
 		return -ENOMEM;
 
Signature · 1 line
1.8.3.1
author
#3 lore raw

PATCH 1/1 ipvs: remove unnecessary space

this patch removes the extra space and use bitmap_zalloc instead

---
 net/netfilter/ipvs/ip_vs_mh.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
net/netfilter/ipvs/ip_vs_mh.c +1 -2
index 94d9d34..3229867 100644
@@ -174,8 +174,7 @@ static int ip_vs_mh_populate(struct ip_vs_mh_state *s,
 		return 0;
 	}
 
-	table =  kcalloc(BITS_TO_LONGS(IP_VS_MH_TAB_SIZE),
-			 sizeof(unsigned long), GFP_KERNEL);
+	table = bitmap_zalloc(IP_VS_MH_TAB_SIZE, GFP_KERNEL);
 	if (!table)
 		return -ENOMEM;
 
Signature · 1 line
1.8.3.1
#4 lore raw
Quoted 12 lines · yangxingwu

this patch removes the extra space and use bitmap_zalloc instead

---
 net/netfilter/ipvs/ip_vs_mh.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
net/netfilter/ipvs/ip_vs_mh.c +0 -0
index 94d9d34..3229867 100644

net/netfilter/ipvs/ip_vs_mh.c static int ip_vs_mh_populate(struct ip_vs_mh_state *s, · line 177

Quoted 6 lines
net/netfilter/ipvs/ip_vs_mh.c +1 -2
@@ -174,8 +174,7 @@ static int ip_vs_mh_populate(struct ip_vs_mh_state *s,
 		return 0;
 	}
 
-	table =  kcalloc(BITS_TO_LONGS(IP_VS_MH_TAB_SIZE),
-			 sizeof(unsigned long), GFP_KERNEL);
+	table = bitmap_zalloc(IP_VS_MH_TAB_SIZE, GFP_KERNEL);

By doing:

        git grep "=  " ...

on the netfilter folders, I see more of these, it would be good if you fix them at once or, probably, you want to use coccinelle for this.

Thanks.

#5 lore raw
Quoted 22 lines · Pablo Neira Ayuso
Quoted 12 lines · yangxingwu

this patch removes the extra space and use bitmap_zalloc instead

---
 net/netfilter/ipvs/ip_vs_mh.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
net/netfilter/ipvs/ip_vs_mh.c +0 -0
index 94d9d34..3229867 100644

net/netfilter/ipvs/ip_vs_mh.c static int ip_vs_mh_populate(struct ip_vs_mh_state *s, · line 177

Quoted 6 lines
net/netfilter/ipvs/ip_vs_mh.c +1 -2
@@ -174,8 +174,7 @@ static int ip_vs_mh_populate(struct ip_vs_mh_state *s,
 		return 0;
 	}
 
-	table =  kcalloc(BITS_TO_LONGS(IP_VS_MH_TAB_SIZE),
-			 sizeof(unsigned long), GFP_KERNEL);
+	table = bitmap_zalloc(IP_VS_MH_TAB_SIZE, GFP_KERNEL);

By doing:

Quoted 4 lines
        git grep "=  " ...

on the netfilter folders, I see more of these, it would be good if you fix them at once or, probably, you want to use coccinelle for this.

If patch subject is "remove unnecessary space" then just remove unnecessary spaces in the patch, otherwise I suggest you rename this to "ipvs: use bitmap_zalloc()" or such, since the space removal here is irrelevant.

#6 lore raw
In reply to Simon Horman
Quoted 13 lines · Simon Horman
Quoted 12 lines · yangxingwu
---
 net/netfilter/ipvs/ip_vs_mh.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
net/netfilter/ipvs/ip_vs_mh.c +0 -0
index 94d9d34..98e358e 100644
@@ -174,8 +174,8 @@ static int ip_vs_mh_populate(struct ip_vs_mh_state *s,
 		return 0;
 	}
 
Quoted 4 lines

net/netfilter/ipvs/ip_vs_mh.c static int ip_vs_mh_populate(struct ip_vs_mh_state *s, · line 178

Quoted 4 lines
net/netfilter/ipvs/ip_vs_mh.c +2 -2
-	table =  kcalloc(BITS_TO_LONGS(IP_VS_MH_TAB_SIZE),
-			 sizeof(unsigned long), GFP_KERNEL);
+	table =	kcalloc(BITS_TO_LONGS(IP_VS_MH_TAB_SIZE),
+			sizeof(unsigned long), GFP_KERNEL);

May I ask one thing? :-)

Please, remove all unnecessary spaces in one go, search for:

git grep "= "

in the netfilter tree, and send a v2 for this one.

Thanks.

author
#7 lore raw

ok

I will remove all unnecessary spaces and send the v2 patch

Thansk Pablo

Quoted 29 lines · Pablo Neira Ayuso <[email protected]> 于2019年7月15日周一 下午4:27写道:
Quoted 13 lines · Simon Horman
Quoted 12 lines · yangxingwu
---
 net/netfilter/ipvs/ip_vs_mh.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
net/netfilter/ipvs/ip_vs_mh.c +0 -0
index 94d9d34..98e358e 100644
@@ -174,8 +174,8 @@ static int ip_vs_mh_populate(struct ip_vs_mh_state *s,
            return 0;
    }
 
Quoted 4 lines

net/netfilter/ipvs/ip_vs_mh.c static int ip_vs_mh_populate(struct ip_vs_mh_state *s, · line 178

Quoted 4 lines
net/netfilter/ipvs/ip_vs_mh.c +2 -2
-   table =  kcalloc(BITS_TO_LONGS(IP_VS_MH_TAB_SIZE),
-                    sizeof(unsigned long), GFP_KERNEL);
+   table = kcalloc(BITS_TO_LONGS(IP_VS_MH_TAB_SIZE),
+                   sizeof(unsigned long), GFP_KERNEL);

May I ask one thing? :-)

Please, remove all unnecessary spaces in one go, search for:

git grep "= "

in the netfilter tree, and send a v2 for this one.

Thanks.

author
#8 lore raw

PATCH v2 1/1 net/netfilter: remove unnecessary spaces

In reply to Pablo Neira Ayuso

this patch removes extra spaces

---
 net/netfilter/ipset/ip_set_hash_gen.h  | 2 +-
 net/netfilter/ipset/ip_set_list_set.c  | 2 +-
 net/netfilter/ipvs/ip_vs_core.c        | 2 +-
 net/netfilter/ipvs/ip_vs_mh.c          | 4 ++--
 net/netfilter/ipvs/ip_vs_proto_tcp.c   | 2 +-
 net/netfilter/nf_conntrack_ftp.c       | 2 +-
 net/netfilter/nf_conntrack_proto_tcp.c | 2 +-
 net/netfilter/nfnetlink_log.c          | 4 ++--
 net/netfilter/nfnetlink_queue.c        | 4 ++--
 net/netfilter/xt_IDLETIMER.c           | 2 +-
 10 files changed, 13 insertions(+), 13 deletions(-)
net/netfilter/ipset/ip_set_hash_gen.h +1 -1
index 10f6196..eb907d2 100644
@@ -954,7 +954,7 @@ struct htype {
 		mtype_data_netmask(d, NCIDR_GET(h->nets[j].cidr[0]));
 #endif
 		key = HKEY(d, h->initval, t->htable_bits);
-		n =  rcu_dereference_bh(hbucket(t, key));
+		n = rcu_dereference_bh(hbucket(t, key));
 		if (!n)
 			continue;
 		for (i = 0; i < n->pos; i++) {
net/netfilter/ipset/ip_set_list_set.c +1 -1
index 8ada318..5c2be76 100644
@@ -289,7 +289,7 @@ struct list_set {
 	if (n &&
 	    !(SET_WITH_TIMEOUT(set) &&
 	      ip_set_timeout_expired(ext_timeout(n, set))))
-		n =  NULL;
+		n = NULL;
 
 	e = kzalloc(set->dsize, GFP_ATOMIC);
 	if (!e)
net/netfilter/ipvs/ip_vs_core.c +1 -1
index 7138556..6b3ae76 100644
@@ -615,7 +615,7 @@ int ip_vs_leave(struct ip_vs_service *svc, struct sk_buff *skb,
 		unsigned int flags = (svc->flags & IP_VS_SVC_F_ONEPACKET &&
 				      iph->protocol == IPPROTO_UDP) ?
 				      IP_VS_CONN_F_ONE_PACKET : 0;
-		union nf_inet_addr daddr =  { .all = { 0, 0, 0, 0 } };
+		union nf_inet_addr daddr = { .all = { 0, 0, 0, 0 } };
 
 		/* create a new connection entry */
 		IP_VS_DBG(6, "%s(): create a cache_bypass entry\n", __func__);
net/netfilter/ipvs/ip_vs_mh.c +2 -2
index 94d9d34..da0280c 100644
@@ -174,8 +174,8 @@ static int ip_vs_mh_populate(struct ip_vs_mh_state *s,
 		return 0;
 	}
 
-	table =  kcalloc(BITS_TO_LONGS(IP_VS_MH_TAB_SIZE),
-			 sizeof(unsigned long), GFP_KERNEL);
+	table = kcalloc(BITS_TO_LONGS(IP_VS_MH_TAB_SIZE),
+			sizeof(unsigned long), GFP_KERNEL);
 	if (!table)
 		return -ENOMEM;
 
net/netfilter/ipvs/ip_vs_proto_tcp.c +1 -1
index 915ac82..c7b46a9 100644
@@ -710,7 +710,7 @@ static int __ip_vs_tcp_init(struct netns_ipvs *ipvs, struct ip_vs_proto_data *pd
 							sizeof(tcp_timeouts));
 	if (!pd->timeout_table)
 		return -ENOMEM;
-	pd->tcp_state_table =  tcp_states;
+	pd->tcp_state_table = tcp_states;
 	return 0;
 }
 
net/netfilter/nf_conntrack_ftp.c +1 -1
index 8c6c11b..26c1ff8 100644
@@ -162,7 +162,7 @@ static int try_rfc959(const char *data, size_t dlen,
 	if (length == 0)
 		return 0;
 
-	cmd->u3.ip =  htonl((array[0] << 24) | (array[1] << 16) |
+	cmd->u3.ip = htonl((array[0] << 24) | (array[1] << 16) |
 				    (array[2] << 8) | array[3]);
 	cmd->u.tcp.port = htons((array[4] << 8) | array[5]);
 	return length;
net/netfilter/nf_conntrack_proto_tcp.c +1 -1
index 1e2cc83..48f3a67 100644
@@ -1225,7 +1225,7 @@ static int tcp_to_nlattr(struct sk_buff *skb, struct nlattr *nla,
 	[CTA_PROTOINFO_TCP_WSCALE_ORIGINAL] = { .type = NLA_U8 },
 	[CTA_PROTOINFO_TCP_WSCALE_REPLY]    = { .type = NLA_U8 },
 	[CTA_PROTOINFO_TCP_FLAGS_ORIGINAL]  = { .len = sizeof(struct nf_ct_tcp_flags) },
-	[CTA_PROTOINFO_TCP_FLAGS_REPLY]	    = { .len =  sizeof(struct nf_ct_tcp_flags) },
+	[CTA_PROTOINFO_TCP_FLAGS_REPLY]	    = { .len = sizeof(struct nf_ct_tcp_flags) },
 };
 
 #define TCP_NLATTR_SIZE	( \
net/netfilter/nfnetlink_log.c +2 -2
index 6dee4f9..d69e186 100644
@@ -651,7 +651,7 @@ static void nfulnl_instance_free_rcu(struct rcu_head *head)
 	/* FIXME: do we want to make the size calculation conditional based on
 	 * what is actually present?  way more branches and checks, but more
 	 * memory efficient... */
-	size =    nlmsg_total_size(sizeof(struct nfgenmsg))
+	size = nlmsg_total_size(sizeof(struct nfgenmsg))
 		+ nla_total_size(sizeof(struct nfulnl_msg_packet_hdr))
 		+ nla_total_size(sizeof(u_int32_t))	/* ifindex */
 		+ nla_total_size(sizeof(u_int32_t))	/* ifindex */
@@ -668,7 +668,7 @@ static void nfulnl_instance_free_rcu(struct rcu_head *head)
 		+ nla_total_size(sizeof(struct nfgenmsg));	/* NLMSG_DONE */
 
 	if (in && skb_mac_header_was_set(skb)) {
-		size +=   nla_total_size(skb->dev->hard_header_len)
+		size += nla_total_size(skb->dev->hard_header_len)
 			+ nla_total_size(sizeof(u_int16_t))	/* hwtype */
 			+ nla_total_size(sizeof(u_int16_t));	/* hwlen */
 	}
net/netfilter/nfnetlink_queue.c +2 -2
index 89750f7..a1ef6e3 100644
@@ -394,7 +394,7 @@ static int nfqnl_put_bridge(struct nf_queue_entry *entry, struct sk_buff *skb)
 	char *secdata = NULL;
 	u32 seclen = 0;
 
-	size =    nlmsg_total_size(sizeof(struct nfgenmsg))
+	size = nlmsg_total_size(sizeof(struct nfgenmsg))
 		+ nla_total_size(sizeof(struct nfqnl_msg_packet_hdr))
 		+ nla_total_size(sizeof(u_int32_t))	/* ifindex */
 		+ nla_total_size(sizeof(u_int32_t))	/* ifindex */
@@ -453,7 +453,7 @@ static int nfqnl_put_bridge(struct nf_queue_entry *entry, struct sk_buff *skb)
 	}
 
 	if (queue->flags & NFQA_CFG_F_UID_GID) {
-		size +=  (nla_total_size(sizeof(u_int32_t))	/* uid */
+		size += (nla_total_size(sizeof(u_int32_t))	/* uid */
 			+ nla_total_size(sizeof(u_int32_t)));	/* gid */
 	}
 
net/netfilter/xt_IDLETIMER.c +1 -1
index 9cec9ea..f56d3ed 100644
@@ -283,7 +283,7 @@ static int __init idletimer_tg_init(void)
 
 	idletimer_tg_kobj = &idletimer_tg_device->kobj;
 
-	err =  xt_register_target(&idletimer_tg);
+	err = xt_register_target(&idletimer_tg);
 	if (err < 0) {
 		pr_debug("couldn't register xt target\n");
 		goto out_dev;
Signature · 1 line
1.8.3.1
#9 lore raw

Re: [PATCH v2] net/netfilter: remove unnecessary spaces

Looks good, but you will have to wait until net-next reopens:

http://vger.kernel.org/~davem/net-next.html

Will keep this in my patchwork until that happens.

Thanks.

Quoted 169 lines · yangxingwu

this patch removes extra spaces

---
 net/netfilter/ipset/ip_set_hash_gen.h  | 2 +-
 net/netfilter/ipset/ip_set_list_set.c  | 2 +-
 net/netfilter/ipvs/ip_vs_core.c        | 2 +-
 net/netfilter/ipvs/ip_vs_mh.c          | 4 ++--
 net/netfilter/ipvs/ip_vs_proto_tcp.c   | 2 +-
 net/netfilter/nf_conntrack_ftp.c       | 2 +-
 net/netfilter/nf_conntrack_proto_tcp.c | 2 +-
 net/netfilter/nfnetlink_log.c          | 4 ++--
 net/netfilter/nfnetlink_queue.c        | 4 ++--
 net/netfilter/xt_IDLETIMER.c           | 2 +-
 10 files changed, 13 insertions(+), 13 deletions(-)
net/netfilter/ipset/ip_set_hash_gen.h +1 -1
index 10f6196..eb907d2 100644
@@ -954,7 +954,7 @@ struct htype {
 		mtype_data_netmask(d, NCIDR_GET(h->nets[j].cidr[0]));
 #endif
 		key = HKEY(d, h->initval, t->htable_bits);
-		n =  rcu_dereference_bh(hbucket(t, key));
+		n = rcu_dereference_bh(hbucket(t, key));
 		if (!n)
 			continue;
 		for (i = 0; i < n->pos; i++) {
net/netfilter/ipset/ip_set_list_set.c +1 -1
index 8ada318..5c2be76 100644
@@ -289,7 +289,7 @@ struct list_set {
 	if (n &&
 	    !(SET_WITH_TIMEOUT(set) &&
 	      ip_set_timeout_expired(ext_timeout(n, set))))
-		n =  NULL;
+		n = NULL;
 
 	e = kzalloc(set->dsize, GFP_ATOMIC);
 	if (!e)
net/netfilter/ipvs/ip_vs_core.c +1 -1
index 7138556..6b3ae76 100644
@@ -615,7 +615,7 @@ int ip_vs_leave(struct ip_vs_service *svc, struct sk_buff *skb,
 		unsigned int flags = (svc->flags & IP_VS_SVC_F_ONEPACKET &&
 				      iph->protocol == IPPROTO_UDP) ?
 				      IP_VS_CONN_F_ONE_PACKET : 0;
-		union nf_inet_addr daddr =  { .all = { 0, 0, 0, 0 } };
+		union nf_inet_addr daddr = { .all = { 0, 0, 0, 0 } };
 
 		/* create a new connection entry */
 		IP_VS_DBG(6, "%s(): create a cache_bypass entry\n", __func__);
net/netfilter/ipvs/ip_vs_mh.c +2 -2
index 94d9d34..da0280c 100644
@@ -174,8 +174,8 @@ static int ip_vs_mh_populate(struct ip_vs_mh_state *s,
 		return 0;
 	}
 
-	table =  kcalloc(BITS_TO_LONGS(IP_VS_MH_TAB_SIZE),
-			 sizeof(unsigned long), GFP_KERNEL);
+	table = kcalloc(BITS_TO_LONGS(IP_VS_MH_TAB_SIZE),
+			sizeof(unsigned long), GFP_KERNEL);
 	if (!table)
 		return -ENOMEM;
 
net/netfilter/ipvs/ip_vs_proto_tcp.c +1 -1
index 915ac82..c7b46a9 100644
@@ -710,7 +710,7 @@ static int __ip_vs_tcp_init(struct netns_ipvs *ipvs, struct ip_vs_proto_data *pd
 							sizeof(tcp_timeouts));
 	if (!pd->timeout_table)
 		return -ENOMEM;
-	pd->tcp_state_table =  tcp_states;
+	pd->tcp_state_table = tcp_states;
 	return 0;
 }
 
net/netfilter/nf_conntrack_ftp.c +1 -1
index 8c6c11b..26c1ff8 100644
@@ -162,7 +162,7 @@ static int try_rfc959(const char *data, size_t dlen,
 	if (length == 0)
 		return 0;
 
-	cmd->u3.ip =  htonl((array[0] << 24) | (array[1] << 16) |
+	cmd->u3.ip = htonl((array[0] << 24) | (array[1] << 16) |
 				    (array[2] << 8) | array[3]);
 	cmd->u.tcp.port = htons((array[4] << 8) | array[5]);
 	return length;
net/netfilter/nf_conntrack_proto_tcp.c +1 -1
index 1e2cc83..48f3a67 100644
@@ -1225,7 +1225,7 @@ static int tcp_to_nlattr(struct sk_buff *skb, struct nlattr *nla,
 	[CTA_PROTOINFO_TCP_WSCALE_ORIGINAL] = { .type = NLA_U8 },
 	[CTA_PROTOINFO_TCP_WSCALE_REPLY]    = { .type = NLA_U8 },
 	[CTA_PROTOINFO_TCP_FLAGS_ORIGINAL]  = { .len = sizeof(struct nf_ct_tcp_flags) },
-	[CTA_PROTOINFO_TCP_FLAGS_REPLY]	    = { .len =  sizeof(struct nf_ct_tcp_flags) },
+	[CTA_PROTOINFO_TCP_FLAGS_REPLY]	    = { .len = sizeof(struct nf_ct_tcp_flags) },
 };
 
 #define TCP_NLATTR_SIZE	( \
net/netfilter/nfnetlink_log.c +2 -2
index 6dee4f9..d69e186 100644
@@ -651,7 +651,7 @@ static void nfulnl_instance_free_rcu(struct rcu_head *head)
 	/* FIXME: do we want to make the size calculation conditional based on
 	 * what is actually present?  way more branches and checks, but more
 	 * memory efficient... */
-	size =    nlmsg_total_size(sizeof(struct nfgenmsg))
+	size = nlmsg_total_size(sizeof(struct nfgenmsg))
 		+ nla_total_size(sizeof(struct nfulnl_msg_packet_hdr))
 		+ nla_total_size(sizeof(u_int32_t))	/* ifindex */
 		+ nla_total_size(sizeof(u_int32_t))	/* ifindex */
@@ -668,7 +668,7 @@ static void nfulnl_instance_free_rcu(struct rcu_head *head)
 		+ nla_total_size(sizeof(struct nfgenmsg));	/* NLMSG_DONE */
 
 	if (in && skb_mac_header_was_set(skb)) {
-		size +=   nla_total_size(skb->dev->hard_header_len)
+		size += nla_total_size(skb->dev->hard_header_len)
 			+ nla_total_size(sizeof(u_int16_t))	/* hwtype */
 			+ nla_total_size(sizeof(u_int16_t));	/* hwlen */
 	}
net/netfilter/nfnetlink_queue.c +2 -2
index 89750f7..a1ef6e3 100644
@@ -394,7 +394,7 @@ static int nfqnl_put_bridge(struct nf_queue_entry *entry, struct sk_buff *skb)
 	char *secdata = NULL;
 	u32 seclen = 0;
 
-	size =    nlmsg_total_size(sizeof(struct nfgenmsg))
+	size = nlmsg_total_size(sizeof(struct nfgenmsg))
 		+ nla_total_size(sizeof(struct nfqnl_msg_packet_hdr))
 		+ nla_total_size(sizeof(u_int32_t))	/* ifindex */
 		+ nla_total_size(sizeof(u_int32_t))	/* ifindex */
@@ -453,7 +453,7 @@ static int nfqnl_put_bridge(struct nf_queue_entry *entry, struct sk_buff *skb)
 	}
 
 	if (queue->flags & NFQA_CFG_F_UID_GID) {
-		size +=  (nla_total_size(sizeof(u_int32_t))	/* uid */
+		size += (nla_total_size(sizeof(u_int32_t))	/* uid */
 			+ nla_total_size(sizeof(u_int32_t)));	/* gid */
 	}
 
net/netfilter/xt_IDLETIMER.c +1 -1
index 9cec9ea..f56d3ed 100644
@@ -283,7 +283,7 @@ static int __init idletimer_tg_init(void)
 
 	idletimer_tg_kobj = &idletimer_tg_device->kobj;
 
-	err =  xt_register_target(&idletimer_tg);
+	err = xt_register_target(&idletimer_tg);
 	if (err < 0) {
 		pr_debug("couldn't register xt target\n");
 		goto out_dev;
Signature · 1 line
1.8.3.1
author
#10 lore raw

Re: [PATCH v2] net/netfilter: remove unnecessary spaces

Thansk Pablo

Quoted 179 lines · Pablo Neira Ayuso <[email protected]> 于2019年7月19日周五 上午2:26写道:

Looks good, but you will have to wait until net-next reopens:

http://vger.kernel.org/~davem/net-next.html

Will keep this in my patchwork until that happens.

Thanks.

Quoted 169 lines · yangxingwu

this patch removes extra spaces

---
 net/netfilter/ipset/ip_set_hash_gen.h  | 2 +-
 net/netfilter/ipset/ip_set_list_set.c  | 2 +-
 net/netfilter/ipvs/ip_vs_core.c        | 2 +-
 net/netfilter/ipvs/ip_vs_mh.c          | 4 ++--
 net/netfilter/ipvs/ip_vs_proto_tcp.c   | 2 +-
 net/netfilter/nf_conntrack_ftp.c       | 2 +-
 net/netfilter/nf_conntrack_proto_tcp.c | 2 +-
 net/netfilter/nfnetlink_log.c          | 4 ++--
 net/netfilter/nfnetlink_queue.c        | 4 ++--
 net/netfilter/xt_IDLETIMER.c           | 2 +-
 10 files changed, 13 insertions(+), 13 deletions(-)
net/netfilter/ipset/ip_set_hash_gen.h +1 -1
index 10f6196..eb907d2 100644
@@ -954,7 +954,7 @@ struct htype {
              mtype_data_netmask(d, NCIDR_GET(h->nets[j].cidr[0]));
 #endif
              key = HKEY(d, h->initval, t->htable_bits);
-             n =  rcu_dereference_bh(hbucket(t, key));
+             n = rcu_dereference_bh(hbucket(t, key));
              if (!n)
                      continue;
              for (i = 0; i < n->pos; i++) {
net/netfilter/ipset/ip_set_list_set.c +1 -1
index 8ada318..5c2be76 100644
@@ -289,7 +289,7 @@ struct list_set {
      if (n &&
          !(SET_WITH_TIMEOUT(set) &&
            ip_set_timeout_expired(ext_timeout(n, set))))
-             n =  NULL;
+             n = NULL;
 
      e = kzalloc(set->dsize, GFP_ATOMIC);
      if (!e)
net/netfilter/ipvs/ip_vs_core.c +1 -1
index 7138556..6b3ae76 100644
@@ -615,7 +615,7 @@ int ip_vs_leave(struct ip_vs_service *svc, struct sk_buff *skb,
              unsigned int flags = (svc->flags & IP_VS_SVC_F_ONEPACKET &&
                                    iph->protocol == IPPROTO_UDP) ?
                                    IP_VS_CONN_F_ONE_PACKET : 0;
-             union nf_inet_addr daddr =  { .all = { 0, 0, 0, 0 } };
+             union nf_inet_addr daddr = { .all = { 0, 0, 0, 0 } };
 
              /* create a new connection entry */
              IP_VS_DBG(6, "%s(): create a cache_bypass entry\n", __func__);
net/netfilter/ipvs/ip_vs_mh.c +2 -2
index 94d9d34..da0280c 100644
@@ -174,8 +174,8 @@ static int ip_vs_mh_populate(struct ip_vs_mh_state *s,
              return 0;
      }
 
-     table =  kcalloc(BITS_TO_LONGS(IP_VS_MH_TAB_SIZE),
-                      sizeof(unsigned long), GFP_KERNEL);
+     table = kcalloc(BITS_TO_LONGS(IP_VS_MH_TAB_SIZE),
+                     sizeof(unsigned long), GFP_KERNEL);
      if (!table)
              return -ENOMEM;
 
net/netfilter/ipvs/ip_vs_proto_tcp.c +1 -1
index 915ac82..c7b46a9 100644
@@ -710,7 +710,7 @@ static int __ip_vs_tcp_init(struct netns_ipvs *ipvs, struct ip_vs_proto_data *pd
                                                      sizeof(tcp_timeouts));
      if (!pd->timeout_table)
              return -ENOMEM;
-     pd->tcp_state_table =  tcp_states;
+     pd->tcp_state_table = tcp_states;
      return 0;
 }
 
net/netfilter/nf_conntrack_ftp.c +1 -1
index 8c6c11b..26c1ff8 100644
@@ -162,7 +162,7 @@ static int try_rfc959(const char *data, size_t dlen,
      if (length == 0)
              return 0;
 
-     cmd->u3.ip =  htonl((array[0] << 24) | (array[1] << 16) |
+     cmd->u3.ip = htonl((array[0] << 24) | (array[1] << 16) |
                                  (array[2] << 8) | array[3]);
      cmd->u.tcp.port = htons((array[4] << 8) | array[5]);
      return length;
net/netfilter/nf_conntrack_proto_tcp.c +1 -1
index 1e2cc83..48f3a67 100644
@@ -1225,7 +1225,7 @@ static int tcp_to_nlattr(struct sk_buff *skb, struct nlattr *nla,
      [CTA_PROTOINFO_TCP_WSCALE_ORIGINAL] = { .type = NLA_U8 },
      [CTA_PROTOINFO_TCP_WSCALE_REPLY]    = { .type = NLA_U8 },
      [CTA_PROTOINFO_TCP_FLAGS_ORIGINAL]  = { .len = sizeof(struct nf_ct_tcp_flags) },
-     [CTA_PROTOINFO_TCP_FLAGS_REPLY]     = { .len =  sizeof(struct nf_ct_tcp_flags) },
+     [CTA_PROTOINFO_TCP_FLAGS_REPLY]     = { .len = sizeof(struct nf_ct_tcp_flags) },
 };
 
 #define TCP_NLATTR_SIZE      ( \
net/netfilter/nfnetlink_log.c +2 -2
index 6dee4f9..d69e186 100644
@@ -651,7 +651,7 @@ static void nfulnl_instance_free_rcu(struct rcu_head *head)
      /* FIXME: do we want to make the size calculation conditional based on
       * what is actually present?  way more branches and checks, but more
       * memory efficient... */
-     size =    nlmsg_total_size(sizeof(struct nfgenmsg))
+     size = nlmsg_total_size(sizeof(struct nfgenmsg))
              + nla_total_size(sizeof(struct nfulnl_msg_packet_hdr))
              + nla_total_size(sizeof(u_int32_t))     /* ifindex */
              + nla_total_size(sizeof(u_int32_t))     /* ifindex */
@@ -668,7 +668,7 @@ static void nfulnl_instance_free_rcu(struct rcu_head *head)
              + nla_total_size(sizeof(struct nfgenmsg));      /* NLMSG_DONE */
 
      if (in && skb_mac_header_was_set(skb)) {
-             size +=   nla_total_size(skb->dev->hard_header_len)
+             size += nla_total_size(skb->dev->hard_header_len)
                      + nla_total_size(sizeof(u_int16_t))     /* hwtype */
                      + nla_total_size(sizeof(u_int16_t));    /* hwlen */
      }
net/netfilter/nfnetlink_queue.c +2 -2
index 89750f7..a1ef6e3 100644
@@ -394,7 +394,7 @@ static int nfqnl_put_bridge(struct nf_queue_entry *entry, struct sk_buff *skb)
      char *secdata = NULL;
      u32 seclen = 0;
 
-     size =    nlmsg_total_size(sizeof(struct nfgenmsg))
+     size = nlmsg_total_size(sizeof(struct nfgenmsg))
              + nla_total_size(sizeof(struct nfqnl_msg_packet_hdr))
              + nla_total_size(sizeof(u_int32_t))     /* ifindex */
              + nla_total_size(sizeof(u_int32_t))     /* ifindex */
@@ -453,7 +453,7 @@ static int nfqnl_put_bridge(struct nf_queue_entry *entry, struct sk_buff *skb)
      }
 
      if (queue->flags & NFQA_CFG_F_UID_GID) {
-             size +=  (nla_total_size(sizeof(u_int32_t))     /* uid */
+             size += (nla_total_size(sizeof(u_int32_t))      /* uid */
                      + nla_total_size(sizeof(u_int32_t)));   /* gid */
      }
 
net/netfilter/xt_IDLETIMER.c +1 -2
index 9cec9ea..f56d3ed 100644
@@ -283,7 +283,7 @@ static int __init idletimer_tg_init(void)
 
      idletimer_tg_kobj = &idletimer_tg_device->kobj;
 
-     err =  xt_register_target(&idletimer_tg);
+     err = xt_register_target(&idletimer_tg);
      if (err < 0) {
              pr_debug("couldn't register xt target\n");
              goto out_dev;
--

1.8.3.1

author
#12 lore raw
In reply to Pablo Neira Ayuso

Pablo

v2 has been sent

I made the following changes:

1. remove all unnecessary spaces in one go
2. revert bitmap_alloc ( since it's irrelevant to this subject)
3. chenge subject to "net/netfiler:remove unnecessary space"

thanks

Quoted 29 lines · Pablo Neira Ayuso <[email protected]> 于2019年7月15日周一 下午4:27写道:
Quoted 13 lines · Simon Horman
Quoted 12 lines · yangxingwu
---
 net/netfilter/ipvs/ip_vs_mh.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
net/netfilter/ipvs/ip_vs_mh.c +0 -0
index 94d9d34..98e358e 100644
@@ -174,8 +174,8 @@ static int ip_vs_mh_populate(struct ip_vs_mh_state *s,
            return 0;
    }
 
Quoted 4 lines

net/netfilter/ipvs/ip_vs_mh.c static int ip_vs_mh_populate(struct ip_vs_mh_state *s, · line 178

Quoted 4 lines
net/netfilter/ipvs/ip_vs_mh.c +2 -2
-   table =  kcalloc(BITS_TO_LONGS(IP_VS_MH_TAB_SIZE),
-                    sizeof(unsigned long), GFP_KERNEL);
+   table = kcalloc(BITS_TO_LONGS(IP_VS_MH_TAB_SIZE),
+                   sizeof(unsigned long), GFP_KERNEL);

May I ask one thing? :-)

Please, remove all unnecessary spaces in one go, search for:

git grep "= "

in the netfilter tree, and send a v2 for this one.

Thanks.