On Tue, 23 Nov 2010 22:08:28 +0300
Vasiliy Kulikov <segoon@openwall.com> wrote:
What I'm suggesting is that we simply do
kbuf = strndup_user(buf, count);
and make strndup_user() do the right thing if `count' turned out to be
crazy large. THis way we don't have to sprinkle decisions about "crazy
largeness" all over the kernel.
And the way in which I suggest that strndup_user() decides whether the
length is too great is to try to kmalloc that amount of memory.
If it succeeds then fine, proceed. If it fails then return an error,
probably ENOMEM. And that attempt to invoke kmalloc() shouldn't spew a
warning.
--