netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][NETFILTER]: Drop the actually unused variable from u32_match_it.
@ 2008-02-18 15:29 Pavel Emelyanov
  2008-02-18 15:44 ` Patrick McHardy
  0 siblings, 1 reply; 2+ messages in thread
From: Pavel Emelyanov @ 2008-02-18 15:29 UTC (permalink / raw)
  To: Patrick McHardy; +Cc: netfilter-devel

The int ret variable is used only to trigger the BUG_ON() after 
the skb_copy_bits() call, so check the call failure directly 
and drop the variable.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>

---

diff --git a/net/netfilter/xt_u32.c b/net/netfilter/xt_u32.c
index 9b8ed39..627e0f3 100644
--- a/net/netfilter/xt_u32.c
+++ b/net/netfilter/xt_u32.c
@@ -26,7 +26,6 @@ static bool u32_match_it(const struct xt_u32 *data,
 	u_int32_t pos;
 	u_int32_t val;
 	u_int32_t at;
-	int ret;
 
 	/*
 	 * Small example: "0 >> 28 == 4 && 8 & 0xFF0000 >> 16 = 6, 17"
@@ -40,8 +39,8 @@ static bool u32_match_it(const struct xt_u32 *data,
 		if (skb->len < 4 || pos > skb->len - 4)
 			return false;
 
-		ret   = skb_copy_bits(skb, pos, &n, sizeof(n));
-		BUG_ON(ret < 0);
+		if (skb_copy_bits(skb, pos, &n, sizeof(n)) < 0)
+			BUG();
 		val   = ntohl(n);
 		nnums = ct->nnums;
 
@@ -67,9 +66,9 @@ static bool u32_match_it(const struct xt_u32 *data,
 				    pos > skb->len - at - 4)
 					return false;
 
-				ret = skb_copy_bits(skb, at + pos, &n,
-						    sizeof(n));
-				BUG_ON(ret < 0);
+				if (skb_copy_bits(skb, at + pos, &n,
+						    sizeof(n)) < 0)
+					BUG();
 				val = ntohl(n);
 				break;
 			}

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

* Re: [PATCH][NETFILTER]: Drop the actually unused variable from u32_match_it.
  2008-02-18 15:29 [PATCH][NETFILTER]: Drop the actually unused variable from u32_match_it Pavel Emelyanov
@ 2008-02-18 15:44 ` Patrick McHardy
  0 siblings, 0 replies; 2+ messages in thread
From: Patrick McHardy @ 2008-02-18 15:44 UTC (permalink / raw)
  To: Pavel Emelyanov; +Cc: netfilter-devel

Pavel Emelyanov wrote:
> The int ret variable is used only to trigger the BUG_ON() after 
> the skb_copy_bits() call, so check the call failure directly 
> and drop the variable.
> 
> Signed-off-by: Pavel Emelyanov <xemul@openvz.org>

Applied, thanks.

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

end of thread, other threads:[~2008-02-18 15:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-18 15:29 [PATCH][NETFILTER]: Drop the actually unused variable from u32_match_it Pavel Emelyanov
2008-02-18 15:44 ` Patrick McHardy

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).