Re: array size limit in module?

Brian Gerst (
Thu, 10 Jan 2002 13:18:35 -0500

Fernando Jimenez wrote:
> Hi
> I am trying to code a simple kernel module and I have found a problem I don't
> quite understand.
> Here is the offending part of code:
> char *sectors_array = NULL;
> ........
> secs_size=131072;
> sectors_array = kmalloc(secs_size*sizeof(char), GFP_KERNEL);
> for(i=0; i<secs_size; i++) {
> sectors_array[i]=0;
> }
> This bit of code, as it is, works fine. However, if I increment secs_size by
> one, ie, I do 'secs_size=131073;' instead of 131072, I get the following:

Use vmalloc for allocations that large, unless you must have the memory
physically contiguous. 128k is the largest amount of memory you can
allocate with kmalloc.


Brian Gerst - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to More majordomo info at Please read the FAQ at