X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=dummynet%2Finclude%2Fsys%2Fmalloc.h;h=285e7896974b58c7416740a41e5611235ad4cf34;hb=1f3693d89c1c88e895721e21751c354e74b99627;hp=d103801303b65a02b924a3b2950a60cdcfe86398;hpb=1c3dc9f45532c25adc21f297422f0f5a7420b8ca;p=ipfw.git diff --git a/dummynet/include/sys/malloc.h b/dummynet/include/sys/malloc.h index d103801..285e789 100644 --- a/dummynet/include/sys/malloc.h +++ b/dummynet/include/sys/malloc.h @@ -8,11 +8,22 @@ */ #ifndef _WIN32 /* this is the linux version */ -#ifndef LINUX_24 -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,22) +/* + * XXX On zeroshell (2.6.25.17) we get a load error + * __you_cannot_kmalloc_that_much + * which is triggered when kmalloc() is called with a large + * compile-time constant argument (include/linux/slab_def.h) + * + * I think it may be a compiler (or source) bug because there is no + * evidence that such a large request is made. + * Making the _size argument to kmalloc volatile prevents the compiler + * from making the mistake, though it is clearly not ideal. + */ + +#if !defined (LINUX_24) && LINUX_VERSION_CODE > KERNEL_VERSION(2,6,22) #define malloc(_size, type, flags) \ - kmalloc(_size, GFP_ATOMIC | __GFP_ZERO) -#else /* LINUX < 2.6.22 and LINUX_24 */ + ({ volatile int _v = _size; kmalloc(_v, GFP_ATOMIC | __GFP_ZERO); }) +#else /* LINUX <= 2.6.22 and LINUX_24 */ /* linux 2.6.22 does not zero allocated memory */ #define malloc(_size, type, flags) \ ({ int _s = _size; \ @@ -20,8 +31,7 @@ if (_ret) memset(_ret, 0, _s); \ (_ret); \ }) -#endif /* !LINUX_24 */ -#endif /* LINUX < 2.6.22 */ +#endif /* LINUX <= 2.6.22 */ #define calloc(_n, _s) malloc((_n * _s), NULL, GFP_ATOMIC | __GFP_ZERO) #define free(_var, type) kfree(_var)