Re: Fw: [PATCH 04/15] [NETFILTER]: Use proc_create() to setup ->proc_fops first

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



David Miller wrote:
Use proc_create() and proc_net_fops_create() to
make sure that ->proc_fops be setup before gluing
PDE to main tree.

Signed-off-by: Wang Chen <wangchen@xxxxxxxxxxxxxx>
---

+++ b/net/ipv4/netfilter/ipt_CLUSTERIP.c
@@ -162,19 +162,16 @@ clusterip_config_init(struct ipt_clusterip_tgt_info *i, __be32 ip,
 	atomic_set(&c->entries, 1);
#ifdef CONFIG_PROC_FS
-	{
-		char buffer[16];
-
-		/* create proc dir entry */
-		sprintf(buffer, "%u.%u.%u.%u", NIPQUAD(ip));
-		c->pde = create_proc_entry(buffer, S_IWUSR|S_IRUSR,
-					   clusterip_procdir);
-		if (!c->pde) {
-			kfree(c);
-			return NULL;
-		}
+	char buffer[16];


Applied with this change on top to fix a compiler warning:

net/ipv4/netfilter/ipt_CLUSTERIP.c: In function 'clusterip_config_init':
net/ipv4/netfilter/ipt_CLUSTERIP.c:165: warning: ISO C90 forbids mixed declarations and code

diff --git a/net/ipv4/netfilter/ipt_CLUSTERIP.c b/net/ipv4/netfilter/ipt_CLUSTERIP.c
index af44818..c20383e 100644
--- a/net/ipv4/netfilter/ipt_CLUSTERIP.c
+++ b/net/ipv4/netfilter/ipt_CLUSTERIP.c
@@ -162,17 +162,19 @@ clusterip_config_init(struct ipt_clusterip_tgt_info *i, __be32 ip,
 	atomic_set(&c->entries, 1);
 
 #ifdef CONFIG_PROC_FS
-	char buffer[16];
-
-	/* create proc dir entry */
-	sprintf(buffer, "%u.%u.%u.%u", NIPQUAD(ip));
-	c->pde = proc_create(buffer, S_IWUSR|S_IRUSR,
-			     clusterip_procdir, &clusterip_proc_fops);
-	if (!c->pde) {
-		kfree(c);
-		return NULL;
+	{
+		char buffer[16];
+
+		/* create proc dir entry */
+		sprintf(buffer, "%u.%u.%u.%u", NIPQUAD(ip));
+		c->pde = proc_create(buffer, S_IWUSR|S_IRUSR,
+				     clusterip_procdir, &clusterip_proc_fops);
+		if (!c->pde) {
+			kfree(c);
+			return NULL;
+		}
+		c->pde->data = c;
 	}
-	c->pde->data = c;
 #endif
 
 	write_lock_bh(&clusterip_lock);

[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux