diff -ru linux-2.4.21/include/linux/vmalloc.h linux/include/linux/vmalloc.h --- linux-2.4.21/include/linux/vmalloc.h Mon Jun 2 14:03:16 2003 +++ linux/include/linux/vmalloc.h Mon Jun 2 15:53:06 2003 @@ -26,6 +26,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 diff -ru linux-2.4.21/kernel/ksyms.c linux/kernel/ksyms.c --- linux-2.4.21/kernel/ksyms.c Mon Jun 2 13:59:22 2003 +++ linux/kernel/ksyms.c Mon Jun 2 15:53:06 2003 @@ -112,6 +112,7 @@ EXPORT_SYMBOL(vfree); EXPORT_SYMBOL(__vmalloc); EXPORT_SYMBOL(vmalloc_to_page); +EXPORT_SYMBOL(vcalloc); EXPORT_SYMBOL(mem_map); EXPORT_SYMBOL(remap_page_range); EXPORT_SYMBOL(max_mapnr); diff -ru linux-2.4.21/mm/vmalloc.c linux/mm/vmalloc.c --- linux-2.4.21/mm/vmalloc.c Mon Jun 2 14:02:13 2003 +++ linux/mm/vmalloc.c Mon Jun 2 15:53:06 2003 @@ -327,3 +327,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; +}