Re: PATCH, RFC: 2.6 Documentation/Codingstyle

From: Valdis . Kletnieks
Date: Fri Feb 13 2004 - 20:01:05 EST


On Fri, 13 Feb 2004 19:38:21 EST, "Kevin O'Connor" said:

> 1 - kfree already checks for null, so checking for null before calling
> kfree is pointless.

As anybody who's chased a 'null pointer dereference' OOPS, plenty of
stuff in the kernel DOESN'T check for null. And this is a *style*
document, not a calling conventions document (unless we're documenting
the use of kmalloc/kfree as well as layout?

If we're doing that, we may well want to expand it slightly to cover
the case of 2 kmallocs, a 'goto out1' and 'goto out2' to demonstrate
proper unwinding/freeing....

Attachment: pgp00000.pgp
Description: PGP signature