On 8/5/05, Roman Zippel <[EMAIL PROTECTED]> wrote: > On Fri, 5 Aug 2005, Arjan van de Ven wrote: > > > This would imply a similiar kmalloc() would be useful as well. > > > Second, how relevant is it for the kernel?
> > we've had a non-negliable amount of security holes because of this > So why don't we have a similiar kmalloc()? You mean something like: static void __bad_kmalloc_safe_nonconstant_size(void); static void __bad_kmalloc_safe_zero_size(void); static void __bad_kmalloc_safe_too_large_size(void); static void __bad_kmalloc_safe_too_large(void); static inline void *kmalloc_safe(size_t nmemb, size_t size,int flags) { if (!__builtin_constant_p(size)) __bad_kmalloc_safe_nonconstant_size(); if ( !size ) __bad_kmalloc_safe_zero_size(); if ( size > 0x10000) __bad_kmalloc_safe_too_large_size(); if (__builtin_constant_p(nmemb) && nmemb > 0x20000/size) __bad_kmalloc_safe_too_large(); if (nmemb <= 0x20000/size) return kmalloc(nmemb*size,flags); else return 0; } -- http://dmoz.org/profiles/pollei.html http://sourceforge.net/users/stephen_pollei/ http://www.orkut.com/Profile.aspx?uid=2455954990164098214 http://stephen_pollei.home.comcast.net/ - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/