Re: [PATCH] slab: Adds two missing kmalloc() checks.

From: Arjan van de Ven
Date: Mon Jan 23 2006 - 12:04:58 EST


On Mon, 2006-01-23 at 15:01 -0200, Luiz Fernando Capitulino wrote:
> Hi Pekka, Arjan,
>
> On Mon, 23 Jan 2006 18:52:02 +0200
> Pekka Enberg <penberg@xxxxxxxxxxxxxx> wrote:
>
> | On Mon, 2006-01-23 at 18:38 +0200, Pekka Enberg wrote:
> | > > Looks good to me. Arjan, you had some objections last time around. Are
> | > > you okay with the change?
> |
> | On Mon, 2006-01-23 at 17:44 +0100, Arjan van de Ven wrote:
> | > I still fail to see the point. Has anyone EVER seen these trigger????
> |
> | Yeah, we probably won't. They seem useful for people who hunt unchecked
> | kmalloc() calls, though.
>
> It really looks useful to me. You don't check for fail because someone has
> seen the fail happen. You check for fail in order to have a robust program.

Generally you are right. You check for fail because you can recover the
failure. In this case the code happens during real early boot, and if it
fails you CANNOT BOOT. And you have so little memory, that it's highly
unlikely that you even got this far. -> You only make the kernel bigger
without any win at all.

Don't get me wrong. Most of the null pointer checks are useful. Just the
ones where you can't recover ANYWAY are not. A BUG_ON() is not better
than just hitting a GPF due to a null pointer, in either case you don't
boot, and probably so early you don't get to see the message either, and
when you do see it.. you get no additional information.



-
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/