Re: [PATCH] Avoid buffer overflows in get_user_pages()

From: Jiri Kosina
Date: Tue Feb 12 2008 - 05:36:40 EST


On Mon, 11 Feb 2008, Andrew Morton wrote:

> > + if (len <= 0)
> > + return 0;
> > /*
> > * Require read or write permissions.
> > * If 'force' is set, we only require the "MAY" flags.
> Can we just convert
> do {
> ...
> } while (len);
> into
> while (len) {
> ...
> }

How would that help?

Rather

while (len > 0) {
...
}

would do the trick.

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