Re: 2.6.18-rc1-mm2

Herbert Xu
2006-07-15T10:34:44Z

On Sat, Jul 15, 2006 at 08:32:07PM +1000, herbert wrote:
>
> Sure, in fact there was a name clash as well with __ret and
> I forgot to update the arch-specific versions.
>
> [PATCH] Let WARN_ON/WARN_ON_ONCE return the condition

Here's a patch to make dev.c use this.

[NET]: Use WARN_ON_ONCE for checksum checks

Use the WARN_ON_ONCE macro rather than open-coding it.

Signed-off-by: Herbert Xu herbert@gondor.apana.org.au>

Cheers,
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
diff --git a/net/core/dev.c b/net/core/dev.c
index 4d2b516..2ea983a 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1165,12 +1165,7 @@ int skb_checksum_help(struct sk_buff *sk
if (inward)
goto out_set_summed;

- if (unlikely(skb_shinfo(skb)->gso_size)) {
- static int warned;
-
- WARN_ON(!warned);
- warned = 1;
-
+ if (WARN_ON_ONCE(skb_shinfo(skb)->gso_size)) {
/* Let GSO fix up the checksum. */
goto out_set_summed;
}
@@ -1219,12 +1214,7 @@ struct sk_buff *skb_gso_segment(struct s
skb->mac_len = skb->nh.raw - skb->data;
__skb_pull(skb, skb->mac_len);

- if (unlikely(skb->ip_summed != CHECKSUM_HW)) {
- static int warned;
-
- WARN_ON(!warned);
- warned = 1;
-
+ if (WARN_ON_ONCE(skb->ip_summed != CHECKSUM_HW)) {
if (skb_header_cloned(skb) &&
(err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC)))
return ERR_PTR(err);