--- linux-2.4.22/include/linux/vmalloc.h Mon Nov 17 19:18:01 2003 +++ linux/include/linux/vmalloc.h Tue Nov 18 13:22:57 2003 @@ -29,6 +29,7 @@ extern void vmfree_area_pages(unsigned long address, unsigned long size); extern int vmalloc_area_pages(unsigned long address, unsigned long size, int gfp_mask, pgprot_t prot); +extern void *vcalloc(unsigned long nmemb, unsigned long elem_size); /* * Allocate any pages --- linux-2.4.22/kernel/ksyms.c Mon Nov 17 19:18:06 2003 +++ linux/kernel/ksyms.c Tue Nov 18 13:22:57 2003 @@ -114,6 +114,7 @@ EXPORT_SYMBOL(__vmalloc); EXPORT_SYMBOL(vmap); EXPORT_SYMBOL(vmalloc_to_page); +EXPORT_SYMBOL(vcalloc); EXPORT_SYMBOL(mem_map); EXPORT_SYMBOL(remap_page_range); EXPORT_SYMBOL(max_mapnr); --- linux-2.4.22/mm/vmalloc.c Mon Nov 17 19:18:07 2003 +++ linux/mm/vmalloc.c Tue Nov 18 13:22:58 2003 @@ -374,3 +374,22 @@ read_unlock(&vmlist_lock); return buf - buf_start; } + +void *vcalloc(unsigned long nmemb, unsigned long elem_size) +{ + unsigned long size; + void *addr; + + /* + * Check that we're not going to overflow. + */ + if (nmemb > (ULONG_MAX / elem_size)) + return NULL; + + size = nmemb * elem_size; + addr = vmalloc(size); + if (addr) + memset(addr, 0, size); + + return addr; +}