Re: [Patch] fs: remove a useless BUG()

From: tytso
Date: Tue Dec 01 2009 - 13:52:52 EST


On Tue, Dec 01, 2009 at 05:55:11PM +0100, Marcin Slusarz wrote:
> On Mon, Nov 30, 2009 at 09:34:14PM -0500, Amerigo Wang wrote:
> > This BUG() is suspicious, it makes its following statements
> > unreachable,
> only when CONFIG_BUG=y

Which is true for all kernels except for the very rare embedded case.

> > and it seems to be useless, since the caller
> > of this function already handles the failure properly.
> because this function can return NULL in other codepath
>
> > Remove it.
> I don't know why this BUG() is there (and maybe it's not really
> needed), but your rationale is wrong.

Your reply is a bit snarky, IMHO. It might have been nicer and more
courteous if you had bothered to take a closer look at the patch
before firing off a reply.

In fact, it's good to avoid BUG() if at all possible, especially if it
can happen in the normally course of events --- such as running out of
memory. Having code which triggers an BUG in an low memory situation
is very bad form.

Looks good to me.

Signed-off-by: "Theodore Ts'o" <tytso@xxxxxxx>

- Ted

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