Re: [PATCH] streq()

Ingo Molnar (mingo@elte.hu)
Tue, 24 Sep 2002 07:40:26 +0200 (CEST)


On Tue, 24 Sep 2002, Rusty Russell wrote:

> Embarrassing, huh? But I just found a bug in my code cause by "if
> (strcmp(a,b))" instead of "if (!strcmp(a,b))".

there's a few more places that tend to cause wasted time, no matter what:

- list_add(elem, list) order of arguments. It can be mixed up easily, and
while i know all the consequences every few months i waste a few hours
on such a thing.

- kmalloc(size, flags)/gfp(order, flags) argument ordering. A few months
ago i wasted two days on such a bug - since 'size' was very small
usually, it never showed up that the allocated buffer was short, until
some rare load-test increased the 'size'.

we should do something about these. list_add() is hard, while we could
introduce a separate type for list heads, there are some valid uses of
non-head list_add(). But perhaps those could be separated out.

handling most of the gfp() mixups should be a bit easier, perhaps by
detecting invalid flags in the inline section, which is optimized away at
runtime in like 95% of the cases?

Ingo

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