Re: kfree(0) - ok?

From: Jan Engelhardt
Date: Fri Aug 17 2007 - 14:37:21 EST



On Aug 17 2007 11:22, Andrew Morton wrote:

>Which is getting pretty idiotic:
>
>akpm:/usr/src/25> grep ZERO_OR_NULL_PTR */*.c
>mm/slab.c: BUG_ON(ZERO_OR_NULL_PTR(cachep->slabp_cache));
>mm/slab.c: if (unlikely(ZERO_OR_NULL_PTR(cachep)))
>mm/slab.c: if (unlikely(ZERO_OR_NULL_PTR(cachep)))
>mm/slab.c: if (unlikely(ZERO_OR_NULL_PTR(objp)))
>mm/slab.c: if (unlikely(ZERO_OR_NULL_PTR(objp)))
>mm/slob.c: if (unlikely(ZERO_OR_NULL_PTR(block)))
>mm/slob.c: if (unlikely(ZERO_OR_NULL_PTR(block)))
>mm/slob.c: if (unlikely(ZERO_OR_NULL_PTR(block)))
>mm/slub.c: if (unlikely(ZERO_OR_NULL_PTR(s)))
>mm/slub.c: if (unlikely(ZERO_OR_NULL_PTR(s)))
>mm/slub.c: if (unlikely(ZERO_OR_NULL_PTR(object)))
>mm/slub.c: if (unlikely(ZERO_OR_NULL_PTR(x)))
>mm/slub.c: if (unlikely(ZERO_OR_NULL_PTR(s)))
>mm/slub.c: if (unlikely(ZERO_OR_NULL_PTR(s)))
>
>are we seeing a pattern here? We could stick the unlikely inside
>ZERO_OR_NULL_PTR() itself.

Yeah,

BUG_ON(unlikely(ZERO_OR_NULL_PTR(..)))

that will really help the bug - "hm, it's Friday, let's BUG" ;-)



Jan
--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/