netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tiny af_packet.c cleanup
@ 2003-09-13  5:50 Mitchell Blank Jr
  2003-09-13  7:35 ` Francois Romieu
  0 siblings, 1 reply; 10+ messages in thread
From: Mitchell Blank Jr @ 2003-09-13  5:50 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev

In both places af_packet.c calls sk_run_filter() it does a "filter =
sk->sk_filter" to store the pointer in a local variable.  However, it
never actually uses this variable for anything -- it always refers to
the filter as sk->sk_filter instead.  Clearly this wasn't intentional.

This patch fixes up both of those cases and cleans up the code a tiny bit.

Patch is versus 2.6.0-test5.

-Mitch

--- linux-2.6.0-test5-VIRGIN/net/packet/af_packet.c	2003-09-08 12:39:53.000000000 -0700
+++ linux-2.6.0-test5mnb1/net/packet/af_packet.c	2003-09-12 13:28:53.857179768 -0700
@@ -433,9 +433,9 @@
 		struct sk_filter *filter;
 
 		bh_lock_sock(sk);
-		if ((filter = sk->sk_filter) != NULL)
-			res = sk_run_filter(skb, sk->sk_filter->insns,
-					    sk->sk_filter->len);
+		filter = sk->sk_filter;
+		if (likely(filter != NULL))	/* re-check under lock */
+			res = sk_run_filter(skb, filter->insns, filter->len);
 		bh_unlock_sock(sk);
 
 		if (res == 0)
@@ -537,9 +537,9 @@
 		struct sk_filter *filter;
 
 		bh_lock_sock(sk);
-		if ((filter = sk->sk_filter) != NULL)
-			res = sk_run_filter(skb, sk->sk_filter->insns,
-					    sk->sk_filter->len);
+		filter = sk->sk_filter;
+		if (likely(filter != NULL))	/* re-check under lock */
+			res = sk_run_filter(skb, filter->insns, filter->len);
 		bh_unlock_sock(sk);
 
 		if (res == 0)

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

end of thread, other threads:[~2003-09-16  5:41 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-09-13  5:50 [PATCH] tiny af_packet.c cleanup Mitchell Blank Jr
2003-09-13  7:35 ` Francois Romieu
2003-09-13  8:02   ` Mitchell Blank Jr
2003-09-13  9:03     ` Francois Romieu
2003-09-13 20:15       ` Mitchell Blank Jr
2003-09-14 10:55         ` Francois Romieu
2003-09-14 11:26           ` Mitchell Blank Jr
2003-09-15 22:56             ` David S. Miller
2003-09-16  3:13               ` Mitchell Blank Jr
2003-09-16  5:41                 ` David S. Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).