Skip to content

Commit

Permalink
[NETFILTER]: xt_u32: drop the actually unused variable from u32_match_it
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Pavel Emelyanov authored and David S. Miller committed Feb 20, 2008
1 parent e2b58a6 commit f449b3b
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions net/netfilter/xt_u32.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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;

Expand All @@ -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;
}
Expand Down

0 comments on commit f449b3b

Please sign in to comment.