diff -ruN linux-2.4.20/mm/vmalloc.c linux/mm/vmalloc.c --- linux-2.4.20/mm/vmalloc.c Fri Jan 10 16:36:03 2003 +++ linux/mm/vmalloc.c Wed Mar 26 12:53:19 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; +} diff -ruN linux-2.4.20/include/linux/vmalloc.h linux/include/linux/vmalloc.h --- linux-2.4.20/include/linux/vmalloc.h Fri Jan 10 16:35:58 2003 +++ linux/include/linux/vmalloc.h Wed Mar 26 12:53:19 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 -ruN linux-2.4.20/kernel/ksyms.c linux/kernel/ksyms.c --- linux-2.4.20/kernel/ksyms.c Fri Jan 10 16:36:02 2003 +++ linux/kernel/ksyms.c Wed Mar 26 12:53:19 2003 @@ -111,6 +111,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);