Re: [PATCH v2] gpu: vga: limit kmalloc'ed memory size

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Andrew Morton
Date: Tuesday, November 23, 2010 - 1:46 pm

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.


--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [PATCH v2] gpu: vga: limit kmalloc'ed memory size, Andrew Morton, (Mon Nov 22, 11:09 am)
Re: [PATCH v2] gpu: vga: limit kmalloc'ed memory size, Vasiliy Kulikov, (Tue Nov 23, 12:08 pm)
Re: [PATCH v2] gpu: vga: limit kmalloc'ed memory size, Andrew Morton, (Tue Nov 23, 1:46 pm)
Re: [PATCH v2] gpu: vga: limit kmalloc'ed memory size, Vasiliy Kulikov, (Wed Nov 24, 11:33 am)