All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2.6.22.3 1/5] nfnetlink_log: Kill duplicate code
@ 2007-09-21 16:48 Michał Mirosław
  2007-09-24 12:26 ` Patrick McHardy
  0 siblings, 1 reply; 3+ messages in thread
From: Michał Mirosław @ 2007-09-21 16:48 UTC (permalink / raw)
  To: netfilter-devel

Kill some cut'n'paste effect.
Just after __nfulnl_send() returning, inst->skb is always NULL.

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>                                                               

diff -urN linux-2.6.22.3-routes-ck1-r4/net/netfilter/nfnetlink_log.c lq1/net/netfilter/nfnetlink_log.c
--- linux-2.6.22.3-routes-ck1-r4/net/netfilter/nfnetlink_log.c	2007-07-09 01:32:17.000000000 +0200
+++ lq1/net/netfilter/nfnetlink_log.c	2007-09-21 13:27:28.000000000 +0200
@@ -189,7 +189,7 @@
 	return NULL;
 }
 
-static int __nfulnl_send(struct nfulnl_instance *inst);
+static int __nfulnl_flush(struct nfulnl_instance *inst);
 
 static void
 __instance_destroy(struct nfulnl_instance *inst)
@@ -203,17 +203,8 @@
 	/* then flush all pending packets from skb */
 
 	spin_lock_bh(&inst->lock);
-	if (inst->skb) {
-		/* timer "holds" one reference (we have one more) */
-		if (del_timer(&inst->timer))
-			instance_put(inst);
-		if (inst->qlen)
-			__nfulnl_send(inst);
-		if (inst->skb) {
-			kfree_skb(inst->skb);
-			inst->skb = NULL;
-		}
-	}
+	if (inst->skb)
+		__nfulnl_flush(inst);
 	spin_unlock_bh(&inst->lock);
 
 	/* and finally put the refcount */
@@ -363,6 +354,16 @@
 	return status;
 }
 
+static int
+__nfulnl_flush(struct nfulnl_instance *inst)
+{
+	/* timer holds a reference */
+	if (del_timer(&inst->timer))
+		instance_put(inst);
+	if (inst->skb)
+		__nfulnl_send(inst);
+}
+
 static void nfulnl_timer(unsigned long data)
 {
 	struct nfulnl_instance *inst = (struct nfulnl_instance *)data;
@@ -649,10 +650,7 @@
 		 * enough room in the skb left. flush to userspace. */
 		UDEBUG("flushing old skb\n");
 
-		/* timer "holds" one reference (we have another one) */
-		if (del_timer(&inst->timer))
-			instance_put(inst);
-		__nfulnl_send(inst);
+		__nfulnl_flush(inst);
 	}
 
 	if (!inst->skb) {
-
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 2.6.22.3 1/5] nfnetlink_log: Kill duplicate code
  2007-09-21 16:48 [PATCH 2.6.22.3 1/5] nfnetlink_log: Kill duplicate code Michał Mirosław
@ 2007-09-24 12:26 ` Patrick McHardy
  2007-09-24 15:42   ` Michał Mirosław
  0 siblings, 1 reply; 3+ messages in thread
From: Patrick McHardy @ 2007-09-24 12:26 UTC (permalink / raw)
  To: Michał Mirosław; +Cc: netfilter-devel

Micha³ Miros³aw wrote:
> Kill some cut'n'paste effect.
> Just after __nfulnl_send() returning, inst->skb is always NULL.


This patch introduces a warning:

net/netfilter/nfnetlink_log.c: In function '__nfulnl_flush':
net/netfilter/nfnetlink_log.c:365: warning: control reaches end of
non-void function

I fixed it by changing __nfulnl_flush to void, but please make sure
this doesn't happen again.

-
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 2.6.22.3 1/5] nfnetlink_log: Kill duplicate code
  2007-09-24 12:26 ` Patrick McHardy
@ 2007-09-24 15:42   ` Michał Mirosław
  0 siblings, 0 replies; 3+ messages in thread
From: Michał Mirosław @ 2007-09-24 15:42 UTC (permalink / raw)
  To: netfilter-devel

On Mon, Sep 24, 2007 at 02:26:49PM +0200, Patrick McHardy wrote:
> Micha³ Miros³aw wrote:
> > Kill some cut'n'paste effect.
> > Just after __nfulnl_send() returning, inst->skb is always NULL.
> This patch introduces a warning:
> net/netfilter/nfnetlink_log.c: In function '__nfulnl_flush':
> net/netfilter/nfnetlink_log.c:365: warning: control reaches end of
> non-void function
> 
> I fixed it by changing __nfulnl_flush to void, but please make sure
> this doesn't happen again.

Ah... Looks like no one is interested a value returned by __nfulnl_send()
but nevertheless it's there...  I'll keep my eyes open wider next time.

Thanks,
Michal Miroslaw
-
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-09-24 15:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-21 16:48 [PATCH 2.6.22.3 1/5] nfnetlink_log: Kill duplicate code Michał Mirosław
2007-09-24 12:26 ` Patrick McHardy
2007-09-24 15:42   ` Michał Mirosław

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.