Re: NGROUPS 2.6.2rc2

From: Linus Torvalds
Date: Wed Jan 28 2004 - 13:13:49 EST




On Wed, 28 Jan 2004, Hugh Dickins wrote:
>
> Sorry, I should have looked further. info->ngroups is an "int", so
> if this check is needed, a check for negativity (or unsigned cast)
> would also be needed.

Nope - there's an implied cast by virtue of the right side being unsigned
in the comparison already.

Although I do believe that it would be better written as

#define MAXGROUPS (1000) /* Arbitrary, but we have to limit it somehere */

if ((unsigned) info->ngroups > MAXGROUPS)
return -ETOOEFFINGLARGE;

as I absolutely _despise_ code that tries to be too generic.

What is it with CS classes that have removed "common sense" from the
equation?

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