Re: [PATCH] kernel/groups.c: Minor bugfix for overflow in binary search

From: Linus Torvalds
Date: Fri Sep 30 2011 - 01:44:39 EST


On Thu, Sep 29, 2011 at 9:39 PM, Josh Zimmerman <jzimmerm@xxxxxxxxxxxxxx> wrote:
>
> Fixed possible unsigned int overflow bug. (2 + 2^(32) - 1)/2 results in overflow; 2 + (2^(32)-1-2)/2 does not.

We can't have that many groups anyway, so the overflow is pretty theoretical.

The max should be NGROUPS_MAX, afaik (65536) and other places have
lower limits (ie sunrpc/nfs). And if some place doesn't limit it
correctly, we have bigger problems than this (the whole allocation and
CPU use issues)

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/