Re: Patch(2.5.45): Eliminate unchecked kfree(disk->random)

Alexander Viro (viro@math.psu.edu)
Mon, 4 Nov 2002 16:37:44 -0500 (EST)


On Mon, 4 Nov 2002, Adam J. Richter wrote:

> alloc_disk in linux-2.5.45/drivers/block/genhd.c calls
> rand_initialize_disk, which can set disk->random to NULL on kmalloc
> failure. disk_release does a kfree(disk->random) without checking.

kfree(NULL) is guaranteed to be OK and is a very common idiom. Talk
to Linus about that - it's a religious issue and FWIW I'm on the same
side ("free(NULL) should be allowed"). IIRC, Linus had claimed quite
a few times that change of kfree() that would break kfree(NULL) would
be considered as a bug.

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