<===== missing check: if (!sectors_array) ....
> for(i=0; i<secs_size; i++) {
> sectors_array[i]=0;
You appear to be missing something that checks for
(even transient) out of memory conditions.
kmalloc() has an internal sensible limit to
allocations of 128Mb (see mm/slab.c, cache_sizes
array). It BUG()s if >128Mb is asked for.
You can get more with __get_free_pages()
and/or vmalloc().
In any case, kmalloc has to allocate contiguous
pages, whilst there may be 4 pages free, there may not be
4 contiguous pages free. This aside, kmalloc()
may /still/ fail.
However, if you are reading sectors probably
wise to group them by page and allocate
each page separately.
-- Alex Bligh - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/